[PATCH] D41939: [LV] Fix incorrect detection of type-promoted Phis

Anna Thomas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 22 14:01:50 PST 2018


anna added inline comments.


================
Comment at: lib/Transforms/Utils/LoopUtils.cpp:372
+        // Two users outside the loop, we should not have it.
+        // TODO: Can this be safely replaced with assert?
+        if (LCSSAPhi)
----------------
I don't think you can assert since you can have uses of `ExitInstruction` in unreachable blocks and unreachable blocks by definition are outside a loop.


================
Comment at: lib/Transforms/Utils/LoopUtils.cpp:388
+      // a type-promoted Phi node.
+      if (LCSSAPhi->getNumUses() > 1)
+        return false;
----------------
getNumUses is linear in the number of uses. This is better: `LCSSAPhi->hasNUsesOrMore(2)`


https://reviews.llvm.org/D41939





More information about the llvm-commits mailing list