[llvm] [InstCombine] Try to freely invert phi nodes (PR #80804)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 7 05:00:31 PST 2024


================
@@ -2375,6 +2375,35 @@ Value *InstCombiner::getFreelyInvertedImpl(Value *V, bool WillInvertAllUses,
     }
   }
 
+  if (PHINode *PN = dyn_cast<PHINode>(V)) {
+    SmallVector<std::pair<Value *, BasicBlock *>, 8> IncomingValues;
+    for (Use &U : PN->operands()) {
+      BasicBlock *IncomingBlock = PN->getIncomingBlock(U);
+      if (isa<PHINode>(U.get()))
+        return nullptr;
----------------
dtcxzyw wrote:

Done.

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


More information about the llvm-commits mailing list