[llvm] [CmpInstAnalysis] Return decomposed bit test as struct (NFC) (PR #109819)

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 24 10:53:58 PDT 2024


================
@@ -870,11 +872,15 @@ static Value *foldSignedTruncationCheck(ICmpInst *ICmp0, ICmpInst *ICmp1,
                            APInt &UnsetBitsMask) -> bool {
     CmpInst::Predicate Pred = ICmp->getPredicate();
     // Can it be decomposed into  icmp eq (X & Mask), 0  ?
-    if (llvm::decomposeBitTestICmp(ICmp->getOperand(0), ICmp->getOperand(1),
-                                   Pred, X, UnsetBitsMask,
-                                   /*LookThroughTrunc=*/false) &&
-        Pred == ICmpInst::ICMP_EQ)
+    if (auto Res =
+            llvm::decomposeBitTestICmp(ICmp->getOperand(0), ICmp->getOperand(1),
+                                       Pred, /*LookThroughTrunc=*/false);
----------------
goldsteinn wrote:

Imo just yank the auto Res = llvm:::dec.... out of the if.

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


More information about the llvm-commits mailing list