1; RUN: llc < %s -march=x86-64 -mtriple=x86_64-unknown-unknown -mcpu=generic | FileCheck %s 2; Both functions should produce the same code. The presence of debug values 3; should not affect the scheduling strategy. 4; Generated from: 5; char argc; 6; class C { 7; public: 8; int test(char ,char ,char ,...); 9; }; 10; void foo() { 11; C c; 12; char lc = argc; 13; c.test(0,argc,0,lc); 14; c.test(0,argc,0,lc); 15; } 16; 17; with 18; clang -O2 -c test.cpp -emit-llvm -S 19; clang -O2 -c test.cpp -emit-llvm -S -g 20; 21 22 23%class.C = type { i8 } 24 25@argc = global i8 0, align 1 26 27declare i32 @test_function(%class.C*, i8 signext, i8 signext, i8 signext, ...) 28 29; CHECK-LABEL: test_without_debug 30; CHECK: movl [[A:%[a-z]+]], [[B:%[a-z]+]] 31; CHECK-NEXT: movl [[A]], [[C:%[a-z]+]] 32define void @test_without_debug() { 33entry: 34 %c = alloca %class.C, align 1 35 %0 = load i8* @argc, align 1 36 %conv = sext i8 %0 to i32 37 %call = call i32 (%class.C*, i8, i8, i8, ...)* @test_function(%class.C* %c, i8 signext 0, i8 signext %0, i8 signext 0, i32 %conv) 38 %1 = load i8* @argc, align 1 39 %call2 = call i32 (%class.C*, i8, i8, i8, ...)* @test_function(%class.C* %c, i8 signext 0, i8 signext %1, i8 signext 0, i32 %conv) 40 ret void 41} 42 43; CHECK-LABEL: test_with_debug 44; CHECK: movl [[A]], [[B]] 45; CHECK-NEXT: movl [[A]], [[C]] 46define void @test_with_debug() { 47entry: 48 %c = alloca %class.C, align 1 49 %0 = load i8* @argc, align 1 50 tail call void @llvm.dbg.value(metadata i8 %0, i64 0, metadata !19, metadata !29) 51 %conv = sext i8 %0 to i32 52 tail call void @llvm.dbg.value(metadata %class.C* %c, i64 0, metadata !18, metadata !29) 53 %call = call i32 (%class.C*, i8, i8, i8, ...)* @test_function(%class.C* %c, i8 signext 0, i8 signext %0, i8 signext 0, i32 %conv) 54 %1 = load i8* @argc, align 1 55 call void @llvm.dbg.value(metadata %class.C* %c, i64 0, metadata !18, metadata !29) 56 %call2 = call i32 (%class.C*, i8, i8, i8, ...)* @test_function(%class.C* %c, i8 signext 0, i8 signext %1, i8 signext 0, i32 %conv) 57 ret void 58} 59 60declare void @llvm.dbg.value(metadata, i64, metadata, metadata) 61 62!llvm.dbg.cu = !{!0} 63!llvm.module.flags = !{!22, !23} 64 65!0 = !{!"", !1, !2, !3, !12, !20, !2} ; [ DW_TAG_compile_unit ] [test.cpp] [DW_LANG_C_plus_plus] 66!1 = !{!"test.cpp", !""} 67!2 = !{} 68!3 = !{!4} 69!4 = !{!"0x2\00C\002\008\008\000\000\000", !1, null, null, !5, null, null, !"_ZTS1C"} ; [ DW_TAG_class_type ] [C] [line 2, size 8, align 8, offset 0] [def] [from ] 70!5 = !{!6} 71!6 = !{!"", !1, !"_ZTS1C", !7, null, null, null, null, null} ; [ DW_TAG_subprogram ] [line 4] [public] [test] 72!7 = !{!"", null, null, null, !8, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] 73!8 = !{!9, !10, !11, !11, !11, null} 74!9 = !{!"", null, null} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed] 75!10 = !{!"", null, null, !"_ZTS1C"} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [artificial] [from _ZTS1C] 76!11 = !{!"0x24\00char\000\008\008\000\000\006", null, null} ; [ DW_TAG_base_type ] [char] [line 0, size 8, align 8, offset 0, enc DW_ATE_signed_char] 77!12 = !{!13} 78!13 = !{!"0x2e\00test_with_debug\00test_with_debug\00test_with_debug\006\000\001\000\000\00256\001\006", !1, !14, !15, null, void ()* @test_with_debug, null, null, !17} ; [ DW_TAG_subprogram ] [line 6] [def] [test_with_debug] 79!14 = !{!"0x29", !1} 80!15 = !{!"0x15\00\000\000\000\000\000\000", null, null, null, !16, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] 81!16 = !{null} 82!17 = !{!18, !19} 83!18 = !{!"0x100\00c\007\000", !13, !14, !"_ZTS1C"} ; [ DW_TAG_auto_variable ] [c] [line 7] 84!19 = !{!"0x100\00lc\008\000", !13, !14, !11} ; [ DW_TAG_auto_variable ] [lc] [line 8] 85!20 = !{!21} 86!21 = !{!"0x34\00argc\00argc\00\001\000\001", null, !14, !11, i8* @argc, null} ; [ DW_TAG_variable ] [argc] [line 1] [def] 87!22 = !{i32 2, !"Dwarf Version", i32 4} 88!23 = !{i32 2, !"Debug Info Version", i32 2} 89!25 = !MDLocation(line: 8, column: 3, scope: !13) 90!29 = !{!"0x102"} ; [ DW_TAG_expression ] 91