[PATCH] D29015: [LoopUnswitch] Fix introduction of UB when hoisted condition may be undef or poison

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 25 09:43:49 PST 2020


reames accepted this revision.
reames added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp:2179
     // the branch in the split block.
     buildPartialUnswitchConditionalBranch(*SplitBB, Invariants, Direction,
+                                          *ClonedPH, *LoopPH, insertFreeze);
----------------
As a further enhancement (separate change), I think you can improve the logic for this case slightly.  If you can prove that the original condition would have triggered UB if any of the invariant components had been poison, then you can avoid the freeze on the partially unswitched condition.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D29015/new/

https://reviews.llvm.org/D29015





More information about the llvm-commits mailing list