1; RUN: llc -O0 < %s -mtriple=x86_64-unknown | FileCheck %s
2; This was extracted from a swift debugger stepping testcase and checks that the
3;   fold (zext (load x)) -> (zext (truncate (zextload x)))
4; rule propagates the SDLoc of the load to the zextload.
5
6; CHECK: .loc {{.*}} main.swift:100
7; CHECK-NOT: .loc
8; CHECK: .loc {{.*}} main.swift:200
9; CHECK-NOT: .loc
10; CHECK: .loc {{.*}} main.swift:300
11; CHECK-NOT: .loc
12declare void @foo(double)
13
14define i32 @zext_load(i32* %arg) !dbg !30 {
15  %1 = bitcast i32* %arg to i8*
16  %2 = getelementptr inbounds i8, i8* %1, i32 1
17  %3 = load i8, i8* %2, align 1, !dbg !100
18  %4 = uitofp i8 %3 to double, !dbg !200
19  call void @foo(double %4), !dbg !200
20  %5 = zext i8 %3 to i32, !dbg !300
21  ret i32 %5
22}
23!llvm.dbg.cu = !{!1}
24!llvm.module.flags = !{!0}
25
26!0 = !{i32 2, !"Debug Info Version", i32 3}
27!1 = distinct !DICompileUnit(language: DW_LANG_Swift, file: !3, isOptimized: false, emissionKind: FullDebug)
28!2 = !DIModule(scope: null, name: "test", includePath: "")
29!3 = !DIFile(filename: "main.swift", directory: "/")
30
31!30 = distinct !DISubprogram(name: "main", scope: !2, file: !3, line: 1, type: !31, isLocal: false, isDefinition: true, isOptimized: false, unit: !1)
32!31 = !DISubroutineType(types: !32)
33!32 = !{}
34
35!100 = !DILocation(line: 100, scope: !30)
36!200 = !DILocation(line: 200, scope: !30)
37!300 = !DILocation(line: 300, scope: !30)
38