[llvm] [InstCombine] Generalize and consolidate phi translation check (PR #106051)

via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 27 10:36:02 PDT 2024


================
@@ -1785,9 +1784,31 @@ Instruction *InstCombinerImpl::foldOpIntoPhi(Instruction &I, PHINode *PN) {
     // Otherwise, we can replace *all* users with the new PHI we form.
   }
 
+  // Check that all operands are phi-translatable.
+  for (Value *Op : I.operands()) {
+    if (Op == PN)
+      continue;
+
+    // Non-instructions never require phi-translation.
+    auto *I = dyn_cast<Instruction>(Op);
+    if (!I)
----------------
goldsteinn wrote:

Can you give this a different name (maybe `OpI`), the shadow variable is very confusing.

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


More information about the llvm-commits mailing list