1; RUN: llc -x86-discriminate-memops < %s | FileCheck %s 2; 3; original source, compiled with -O3 -gmlt -fdebug-info-for-profiling: 4; int sum(int* arr, int pos1, int pos2) { 5; return arr[pos1] + arr[pos2]; 6; } 7; 8; ModuleID = 'test.cc' 9source_filename = "test.cc" 10target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 11target triple = "x86_64-unknown-linux-gnu" 12 13; Function Attrs: norecurse nounwind readonly uwtable 14define i32 @sum(ptr %arr, i32 %pos1, i32 %pos2) !dbg !7 { 15entry: 16 %idxprom = sext i32 %pos1 to i64, !dbg !9 17 %arrayidx = getelementptr inbounds i32, ptr %arr, i64 %idxprom, !dbg !9 18 %0 = load i32, ptr %arrayidx, align 4, !dbg !9, !tbaa !10 19 %idxprom1 = sext i32 %pos2 to i64, !dbg !14 20 %arrayidx2 = getelementptr inbounds i32, ptr %arr, i64 %idxprom1, !dbg !14 21 %1 = load i32, ptr %arrayidx2, align 4, !dbg !14, !tbaa !10 22 %add = add nsw i32 %1, %0, !dbg !15 23 ret i32 %add, !dbg !16 24} 25 26attributes #0 = { "target-cpu"="x86-64" } 27 28!llvm.dbg.cu = !{!0} 29!llvm.module.flags = !{!3, !4, !5} 30!llvm.ident = !{!6} 31 32!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, isOptimized: true, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2, debugInfoForProfiling: true) 33!1 = !DIFile(filename: "test.cc", directory: "/tmp") 34!2 = !{} 35!3 = !{i32 2, !"Dwarf Version", i32 4} 36!4 = !{i32 2, !"Debug Info Version", i32 3} 37!5 = !{i32 1, !"wchar_size", i32 4} 38!6 = !{!"clang version 7.0.0 (trunk 322155) (llvm/trunk 322159)"} 39!7 = distinct !DISubprogram(name: "sum", linkageName: "sum", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: true, unit: !0) 40!8 = !DISubroutineType(types: !2) 41!9 = !DILocation(line: 2, column: 10, scope: !7) 42!10 = !{!11, !11, i64 0} 43!11 = !{!"int", !12, i64 0} 44!12 = !{!"omnipotent char", !13, i64 0} 45!13 = !{!"Simple C++ TBAA"} 46!14 = !DILocation(line: 2, column: 22, scope: !7) 47!15 = !DILocation(line: 2, column: 20, scope: !7) 48!16 = !DILocation(line: 2, column: 3, scope: !7) 49 50;CHECK-LABEL: sum: 51;CHECK: # %bb.0: 52;CHECK: movl (%rdi,%rax,4), %eax 53;CHECK-NEXT: .loc 1 2 20 discriminator 2 # test.cc:2:20 54;CHECK-NEXT: addl (%rdi,%rcx,4), %eax 55;CHECK-NEXT: .loc 1 2 3 # test.cc:2:3 56