diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index 69541247d47..d1a330d0948 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -9628,16 +9628,31 @@ void ScalarEvolution::print(raw_ostream &OS) const { bool First = true; for (auto *Iter = L; Iter; Iter = Iter->getParentLoop()) { if (First) { - OS << "\t\t" "LoopDispositions: [ "; + OS << "\t\t" "LoopDispositions: { "; First = false; } else { OS << ", "; } - OS << loopDispositionToStr(SE.getLoopDisposition(SV, Iter)); + Iter->getHeader()->printAsOperand(OS, /*PrintType=*/false); + OS << ": " << loopDispositionToStr(SE.getLoopDisposition(SV, Iter)); } - OS << " ]"; + for (auto *InnerL : depth_first(L)) { + if (InnerL == L) + continue; + if (First) { + OS << "\t\t" "LoopDispositions: { "; + First = false; + } else { + OS << ", "; + } + + InnerL->getHeader()->printAsOperand(OS, /*PrintType=*/false); + OS << ": " << loopDispositionToStr(SE.getLoopDisposition(SV, InnerL)); + } + + OS << " }"; } OS << "\n"; diff --git a/test/Analysis/ScalarEvolution/scev-dispositions.ll b/test/Analysis/ScalarEvolution/scev-dispositions.ll index 8f5143930bb..4e382a93cda 100644 --- a/test/Analysis/ScalarEvolution/scev-dispositions.ll +++ b/test/Analysis/ScalarEvolution/scev-dispositions.ll @@ -11,15 +11,15 @@ define void @single_loop(i32* %buf, i32 %start) { %idx = phi i32 [ %start, %entry ], [ %idx.inc, %loop ] ; CHECK: %counter = phi i32 [ 0, %entry ], [ %counter.inc, %loop ] -; CHECK-NEXT: --> {{.*}} LoopDispositions: [ Computable ] +; CHECK-NEXT: --> {{.*}} LoopDispositions: { %loop: Computable } ; CHECK: %idx = phi i32 [ %start, %entry ], [ %idx.inc, %loop ] -; CHECK-NEXT: --> {{.*}} LoopDispositions: [ Computable ] +; CHECK-NEXT: --> {{.*}} LoopDispositions: { %loop: Computable } ; CHECK: %val2 = add i32 %start, 400 -; CHECK-NEXT: --> {{.*}} LoopDispositions: [ Invariant ] +; CHECK-NEXT: --> {{.*}} LoopDispositions: { %loop: Invariant } ; CHECK: %idx.inc = add nsw i32 %idx, 1 -; CHECK-NEXT: --> {{.*}} LoopDispositions: [ Computable ] +; CHECK-NEXT: --> {{.*}} LoopDispositions: { %loop: Computable } ; CHECK: %val3 = load volatile i32, i32* %buf -; CHECK-NEXT: --> {{.*}} LoopDispositions: [ Variant ] +; CHECK-NEXT: --> {{.*}} LoopDispositions: { %loop: Variant } %val2 = add i32 %start, 400 %idx.inc = add nsw i32 %idx, 1 @@ -38,15 +38,15 @@ define void @nested_loop(double* %p, i64 %m) { ; CHECK-LABEL: Classifying expressions for: @nested_loop ; CHECK: %j = phi i64 [ 0, %entry ], [ %j.next, %outer.latch ] -; CHECK-NEXT: --> {{.*}} LoopDispositions: [ Computable ] +; CHECK-NEXT: --> {{.*}} LoopDispositions: { %outer.loop: Computable, %bb: Invariant } ; CHECK: %i = phi i64 [ 0, %outer.loop ], [ %i.next, %bb ] -; CHECK-NEXT: --> {{.*}} LoopDispositions: [ Computable, Variant ] +; CHECK-NEXT: --> {{.*}} LoopDispositions: { %bb: Computable, %outer.loop: Variant } ; CHECK: %j.add = add i64 %j, 100 -; CHECK-NEXT: --> {{.*}} LoopDispositions: [ Invariant, Computable ] +; CHECK-NEXT: --> {{.*}} LoopDispositions: { %bb: Invariant, %outer.loop: Computable } ; CHECK: %i.next = add i64 %i, 1 -; CHECK-NEXT: --> {{.*}} LoopDispositions: [ Computable, Variant ] +; CHECK-NEXT: --> {{.*}} LoopDispositions: { %bb: Computable, %outer.loop: Variant } ; CHECK: %j.next = add i64 %j, 91 -; CHECK-NEXT: --> {{.*}} LoopDispositions: [ Computable ] +; CHECK-NEXT: --> {{.*}} LoopDispositions: { %outer.loop: Computable, %bb: Invariant } entry: %k = icmp sgt i64 %m, 0