llvm.org GIT mirror llvm / b78000e
[SCEV] Tweak the output format and content of -analyze In the "LoopDispositions:" section: - Instead of printing out a list, print out a "dictionary" to make it obvious by inspection which disposition is for which loop. This is just a cosmetic change. - Print dispositions for parent _and_ sibling loops. I will use this to write a test case. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268405 91177308-0d34-0410-b5e6-96231b3b80d8 Sanjoy Das 4 years ago
2 changed file(s) with 28 addition(s) and 13 deletion(s). Raw diff Collapse all Expand all
96279627 bool First = true;
96289628 for (auto *Iter = L; Iter; Iter = Iter->getParentLoop()) {
96299629 if (First) {
9630 OS << "\t\t" "LoopDispositions: [ ";
9630 OS << "\t\t" "LoopDispositions: { ";
96319631 First = false;
96329632 } else {
96339633 OS << ", ";
96349634 }
96359635
9636 OS << loopDispositionToStr(SE.getLoopDisposition(SV, Iter));
9636 Iter->getHeader()->printAsOperand(OS, /*PrintType=*/false);
9637 OS << ": " << loopDispositionToStr(SE.getLoopDisposition(SV, Iter));
96379638 }
96389639
9639 OS << " ]";
9640 for (auto *InnerL : depth_first(L)) {
9641 if (InnerL == L)
9642 continue;
9643 if (First) {
9644 OS << "\t\t" "LoopDispositions: { ";
9645 First = false;
9646 } else {
9647 OS << ", ";
9648 }
9649
9650 InnerL->getHeader()->printAsOperand(OS, /*PrintType=*/false);
9651 OS << ": " << loopDispositionToStr(SE.getLoopDisposition(SV, InnerL));
9652 }
9653
9654 OS << " }";
96409655 }
96419656
96429657 OS << "\n";
1010 %idx = phi i32 [ %start, %entry ], [ %idx.inc, %loop ]
1111
1212 ; CHECK: %counter = phi i32 [ 0, %entry ], [ %counter.inc, %loop ]
13 ; CHECK-NEXT: --> {{.*}} LoopDispositions: [ Computable ]
13 ; CHECK-NEXT: --> {{.*}} LoopDispositions: { %loop: Computable }
1414 ; CHECK: %idx = phi i32 [ %start, %entry ], [ %idx.inc, %loop ]
15 ; CHECK-NEXT: --> {{.*}} LoopDispositions: [ Computable ]
15 ; CHECK-NEXT: --> {{.*}} LoopDispositions: { %loop: Computable }
1616 ; CHECK: %val2 = add i32 %start, 400
17 ; CHECK-NEXT: --> {{.*}} LoopDispositions: [ Invariant ]
17 ; CHECK-NEXT: --> {{.*}} LoopDispositions: { %loop: Invariant }
1818 ; CHECK: %idx.inc = add nsw i32 %idx, 1
19 ; CHECK-NEXT: --> {{.*}} LoopDispositions: [ Computable ]
19 ; CHECK-NEXT: --> {{.*}} LoopDispositions: { %loop: Computable }
2020 ; CHECK: %val3 = load volatile i32, i32* %buf
21 ; CHECK-NEXT: --> {{.*}} LoopDispositions: [ Variant ]
21 ; CHECK-NEXT: --> {{.*}} LoopDispositions: { %loop: Variant }
2222
2323 %val2 = add i32 %start, 400
2424 %idx.inc = add nsw i32 %idx, 1
3737 ; CHECK-LABEL: Classifying expressions for: @nested_loop
3838
3939 ; CHECK: %j = phi i64 [ 0, %entry ], [ %j.next, %outer.latch ]
40 ; CHECK-NEXT: --> {{.*}} LoopDispositions: [ Computable ]
40 ; CHECK-NEXT: --> {{.*}} LoopDispositions: { %outer.loop: Computable, %bb: Invariant }
4141 ; CHECK: %i = phi i64 [ 0, %outer.loop ], [ %i.next, %bb ]
42 ; CHECK-NEXT: --> {{.*}} LoopDispositions: [ Computable, Variant ]
42 ; CHECK-NEXT: --> {{.*}} LoopDispositions: { %bb: Computable, %outer.loop: Variant }
4343 ; CHECK: %j.add = add i64 %j, 100
44 ; CHECK-NEXT: --> {{.*}} LoopDispositions: [ Invariant, Computable ]
44 ; CHECK-NEXT: --> {{.*}} LoopDispositions: { %bb: Invariant, %outer.loop: Computable }
4545 ; CHECK: %i.next = add i64 %i, 1
46 ; CHECK-NEXT: --> {{.*}} LoopDispositions: [ Computable, Variant ]
46 ; CHECK-NEXT: --> {{.*}} LoopDispositions: { %bb: Computable, %outer.loop: Variant }
4747 ; CHECK: %j.next = add i64 %j, 91
48 ; CHECK-NEXT: --> {{.*}} LoopDispositions: [ Computable ]
48 ; CHECK-NEXT: --> {{.*}} LoopDispositions: { %outer.loop: Computable, %bb: Invariant }
4949
5050 entry:
5151 %k = icmp sgt i64 %m, 0