[llvm] [InstCombine] Replace an integer comparison of a `phi` node with multiple `ucmp`/`scmp` operands and a constant with `phi` of individual comparisons of original intrinsic's arguments (PR #107769)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 8 09:46:25 PDT 2024


================
@@ -1809,6 +1809,7 @@ Instruction *InstCombinerImpl::foldOpIntoPhi(Instruction &I, PHINode *PN) {
   // Check to see whether the instruction can be folded into each phi operand.
   // If there is one operand that does not fold, remember the BB it is in.
   SmallVector<Value *> NewPhiValues;
+  SmallVector<unsigned int> OpsToMoveUseTo;
   BasicBlock *NonSimplifiedBB = nullptr;
   Value *NonSimplifiedInVal = nullptr;
----------------
nikic wrote:

It looks like the logic is now duplicated between OpsToMoveUseTo and NonSimplifiedBB/InVal? Both are non-simplified cases where we move the operation to the predecessors, so we shouldn't need separate handling for the case where there is one and the case where there are multiple.

https://github.com/llvm/llvm-project/pull/107769


More information about the llvm-commits mailing list