[PATCH] D16382: Add LoopSimplifyCFG pass

Michael Zolotukhin via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 21 12:32:21 PST 2016


mzolotukhin added inline comments.

================
Comment at: lib/Transforms/Scalar/LoopSimplifyCFG.cpp:88
@@ +87,3 @@
+
+  bool changed = false;
+  DominatorTree *DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();
----------------
Nitpick: s/changed/Changed/

================
Comment at: test/Transforms/LoopSimplifyCFG/merge-header.ll:5-6
@@ +4,4 @@
+; CHECK: entry
+; CHECK-NEXT: br label %inner
+define i32 @foo(i32* %P, i64* %Q) {
+entry:
----------------
Hmm, the header here is `%outer`, `%entry` is a preheader:
```
$ opt -analyze -loops < merge-header.ll
Printing analysis 'Natural Loop Information' for function 'foo':
Loop at depth 1 containing: %outer<header>,%inner<exiting>,%outer.latch2<latch>
```

That said, I think the test is correct in current form (I misread it first time), but I think we might want to make it more explicit. Like, we can check something like this:
```
CHECK:      entry:
CHECK-NEXT:   br label %[[LOOP:%.]]
CHECK:      [[LOOP]:
CHECK-NEXT:   phi
CHECK-NOT:    br label
CHECK:        br i1
```
This way we make sure that the blocks are actually merged.



Repository:
  rL LLVM

http://reviews.llvm.org/D16382





More information about the llvm-commits mailing list