[llvm] [InstCombine] foldOpIntoPhi should apply to icmp with non-constant operand (PR #147676)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 9 02:10:37 PDT 2025
================
@@ -7699,6 +7695,10 @@ Instruction *InstCombinerImpl::visitICmpInst(ICmpInst &I) {
if (Instruction *New = foldSignBitTest(I))
return New;
+ if (auto *PN = dyn_cast<PHINode>(Op0))
----------------
nikic wrote:
There is no guarantee that the phi node will be op0 if the other operand is not constant, so we should handle both. Can you please add a commuted test?
https://github.com/llvm/llvm-project/pull/147676
More information about the llvm-commits
mailing list