[llvm] [NFC][SimplifyCFG] Simplify operators for the combined predicate in `mergeConditionalStoreToAddress` (PR #155058)

Mircea Trofin via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 25 14:02:31 PDT 2025


================
@@ -4418,13 +4420,11 @@ static bool mergeConditionalStoreToAddress(
   IRBuilder<> QB(PostBB, PostBBFirst);
   QB.SetCurrentDebugLocation(PostBBFirst->getStableDebugLoc());
 
-  Value *PPred = PStore->getParent() == PTB ? PCond : QB.CreateNot(PCond);
-  Value *QPred = QStore->getParent() == QTB ? QCond : QB.CreateNot(QCond);
+  InvertPCond ^= (PStore->getParent() != PTB);
+  InvertQCond ^= (QStore->getParent() != QTB);
+  Value *const PPred = InvertPCond ? PCond : QB.CreateNot(PCond);
+  Value *const QPred = InvertQCond ? QCond : QB.CreateNot(QCond);
----------------
mtrofin wrote:

Lol. And I followed convinced I didn't see it.

OK, clearly an argument for the readability aspect!

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


More information about the llvm-commits mailing list