80 lines · plain
1; RUN: opt -mtriple=aarch64-unknown-linux-gnu -S %s -passes=sroa -o - | FileCheck %s2 3; In this test we want to ensure that the merged location of phi instruction4; belongs to the correct scope (DILexicalBlockFile), so that line number5; of that location belongs to the corresponding file.6 7; Generated with clang from8; # 1 "1.c" 19; # 1 "1.c" 210; int foo(int a) {11; int i = 0;12; if ((a & 1) == 1) {13; a -= 1;14; # 1 "m.c" 115; # 40 "m.c"16; i += a;17; i -= 10*a;18; i *= a*a;19; # 6 "1.c" 220; } else {21; a += 3;22; # 1 "m.c" 123; # 40 "m.c"24; i += a;25; i -= 10*a;26; i *= a*a;27; # 9 "1.c" 228; }29; return i;30; }31 32target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32"33target triple = "aarch64-unknown-linux-gnu"34 35define i32 @foo() !dbg !3 {36; CHECK: phi i32 {{.*}}, !dbg [[PHILOC:![0-9]+]]37;38entry:39 %i = alloca i32, align 440 br i1 false, label %if.then, label %if.else41 42if.then: ; preds = %entry43 store i32 1, ptr %i, align 4, !dbg !744 br label %if.end45 46if.else: ; preds = %entry47 store i32 0, ptr %i, align 4, !dbg !1248 br label %if.end49 50if.end: ; preds = %if.else, %if.then51 %0 = load i32, ptr %i, align 452 ret i32 053}54 55!llvm.dbg.cu = !{!0}56!llvm.module.flags = !{!2}57 58!0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, producer: "clang version 21.0.0git", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)59!1 = !DIFile(filename: "repro.c", directory: "")60!2 = !{i32 2, !"Debug Info Version", i32 3}61!3 = distinct !DISubprogram(name: "foo", scope: !4, file: !4, line: 1, type: !5, scopeLine: 1, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !6)62!4 = !DIFile(filename: "1.c", directory: "")63!5 = !DISubroutineType(types: !6)64!6 = !{}65!7 = !DILocation(line: 42, column: 3, scope: !8)66!8 = !DILexicalBlockFile(scope: !10, file: !9, discriminator: 0)67!9 = !DIFile(filename: "m.c", directory: "")68!10 = distinct !DILexicalBlock(scope: !11, file: !4, line: 3, column: 21)69!11 = distinct !DILexicalBlock(scope: !3, file: !4, line: 3, column: 7)70!12 = !DILocation(line: 42, column: 3, scope: !13)71!13 = !DILexicalBlockFile(scope: !14, file: !9, discriminator: 0)72!14 = distinct !DILexicalBlock(scope: !11, file: !4, line: 6, column: 9)73 74; CHECK: [[SP:![0-9]+]] = distinct !DISubprogram(name: "foo", scope: [[FILE1:![0-9]+]], file: [[FILE1]], line: 175; CHECK: [[FILE1]] = !DIFile(filename: "1.c", directory: "")76; CHECK: [[PHILOC]] = !DILocation(line: 42, column: 3, scope: [[LBF:![0-9]+]])77; CHECK: [[LBF]] = !DILexicalBlockFile(scope: [[LB:![0-9]+]], file: [[FILE2:![0-9]+]], discriminator: 0)78; CHECK: [[FILE2]] = !DIFile(filename: "m.c", directory: "")79; CHECK: [[LB]] = distinct !DILexicalBlock(scope: [[SP]], file: [[FILE1]], line: 3, column: 7)80