[PATCH] D15931: [LoopUnswitch] Create a PHINode for the original landingpad only if it has some uses

Chen Li via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 6 11:49:32 PST 2016


chenli added inline comments.

================
Comment at: lib/Transforms/Scalar/LoopUnswitch.cpp:1064
@@ +1063,3 @@
+      auto *OriginalLPad = ExitBlocks[i]->getLandingPadInst();
+      if (!OriginalLPad->use_empty()) {
+        assert(!LPad->getType()->isTokenTy() &&
----------------
reames wrote:
> I believe this code is wrong as written. If you don't insert the PHI, you still need to replace the original LandingPad with the new one.  
The original LandingPad is in the original loop, and the new LandingPad is in the cloned loop after switch. They will join into the same loop exit block where requires a PHINode which takes both the original landingPad and new LandingPad as incoming values. The original LandingPad should be independent of the new LandingPad and not be replaced. 


http://reviews.llvm.org/D15931





More information about the llvm-commits mailing list