[PATCH] D108408: [InstCombine] Transform X == 0 ? 0 : X * Y --> X * freeze(Y).
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 25 14:32:11 PDT 2021
nikic added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:750
+ Mul = BinaryOperator::CreateMul(X, Builder.CreateFreeze(Y));
+ else
+ Mul = BinaryOperator::CreateMul(Builder.CreateFreeze(X), Y);
----------------
What ensures that the other case is `Y == CmpLHS`? Couldn't this be comparing a completely unrelated value?
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:753
+ Mul->copyIRFlags(cast<Instruction>(FalseVal));
+ FalseVal->replaceAllUsesWith(Mul);
+ return Mul;
----------------
In InstCombine, replaceInstUsesWith should be used in place of replaceAllUsesWith for worklist management reasons.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D108408/new/
https://reviews.llvm.org/D108408
More information about the llvm-commits
mailing list