76 lines · plain
1; RUN: opt --passes=loop-rotate %s -S -o - | FileCheck %s2 3;; Rotate:4;; +------------------> for.end.5;; |6;; entry -> for.cond -> for.body7;; ^ |8;; +-----------+9;;10;; Into:11;;12;; +------> for.end.13;; |14;; entry (+ for.cond`0) -> for.body (+ for.cond) -+15;; ^ |16;; +-------------------+17;; Check for.cond's duplicated store and br have their source atoms remapped.18 19; CHECK: entry:20; CHECK: store i32 0, ptr @glob, align 16, !dbg [[G3R1:![0-9]+]]21; CHECK: br label %for.body, !dbg [[G4R1:![0-9]+]]22;23; CHECK: for.body:24; CHECK: store i32 {{.*}}, ptr @glob, align 16, !dbg [[G1R1:![0-9]+]]25; CHECK: [[CMP:%.*]] = icmp slt i32 {{.*}}, 100, !dbg [[G2R2:![0-9]+]]26; CHECK: br i1 [[CMP]], label %for.body, label %for.end, !dbg [[G2R1:![0-9]+]]27;28; CHECK: distinct !DISubprogram(name: "test1", {{.*}}keyInstructions: true)29; CHECK: [[G3R1]] = !DILocation(line: 4{{.*}}, atomGroup: 3, atomRank: 1)30; CHECK: [[G4R1]] = !DILocation(line: 6{{.*}}, atomGroup: 4, atomRank: 1)31; CHECK: [[G1R1]] = !DILocation(line: 4{{.*}}, atomGroup: 1, atomRank: 1)32; CHECK: [[G2R2]] = !DILocation(line: 5{{.*}}, atomGroup: 2, atomRank: 2)33; CHECK: [[G2R1]] = !DILocation(line: 6{{.*}}, atomGroup: 2, atomRank: 1)34 35@glob = global i32 036 37define void @test1() #0 !dbg !5 {38entry:39 %array = alloca [20 x i32], align 1640 br label %for.cond41 42for.cond: ; preds = %for.body, %entry43 %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ]44 store i32 %i.0, ptr @glob, align 16, !dbg !DILocation(line: 4, scope: !5, atomGroup: 1, atomRank: 1)45 %cmp = icmp slt i32 %i.0, 100, !dbg !DILocation(line: 5, scope: !5, atomGroup: 2, atomRank: 2)46 br i1 %cmp, label %for.body, label %for.end, !dbg !DILocation(line: 6, scope: !5, atomGroup: 2, atomRank: 1)47 48for.body: ; preds = %for.cond49 %inc = add nsw i32 %i.0, 150 store i32 0, ptr %array, align 1651 br label %for.cond52 53for.end: ; preds = %for.cond54 %arrayidx.lcssa = phi ptr [ %array, %for.cond ]55 call void @g(ptr %arrayidx.lcssa)56 ret void57}58 59declare void @g(ptr)60 61attributes #0 = { nounwind ssp }62attributes #1 = { noduplicate }63 64!llvm.dbg.cu = !{!0}65!llvm.debugify = !{!2, !3}66!llvm.module.flags = !{!4}67 68!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)69!1 = !DIFile(filename: "test.ll", directory: "/")70!2 = !{i32 12}71!3 = !{i32 0}72!4 = !{i32 2, !"Debug Info Version", i32 3}73!5 = distinct !DISubprogram(name: "test1", linkageName: "test1", scope: null, file: !1, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, keyInstructions: true)74!6 = !DISubroutineType(types: !7)75!7 = !{}76