[PATCH] D132443: [LSR] Fold terminating condition to other IV when possible
Yueh-Ting (eop) Chen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 14 12:14:49 PDT 2022
eopXD added inline comments.
================
Comment at: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:6844
+
+ OldTermCond->replaceAllUsesWith(
+ PoisonValue::get(OldTermCond->getType()));
----------------
craig.topper wrote:
> What are the other users of `OldTermCond` and why is it ok to replace them with poison?
Nice catch. Added check and negative test for it.
================
Comment at: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:6849
+ // Cleanup the old terminating condition that is no longer used
+ // Clear the PHINode and DCE will do the rest...
+ while (ToFold->getNumIncomingValues())
----------------
craig.topper wrote:
> Is there a DCE after this? Earlier optimizations in this function used DeleteDeadPHIs to recursively clean up.
Yes. Removing the terminal condition and leveraging `DeleteDeadPHIs` is a much better approach. Thank you.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132443/new/
https://reviews.llvm.org/D132443
More information about the llvm-commits
mailing list