[llvm] 48324f0 - [ValueTracking] Combine variable declaration with its only assignment. NFC (#89526)

via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 21 09:57:05 PDT 2024


Author: Craig Topper
Date: 2024-04-21T09:57:01-07:00
New Revision: 48324f0f7b26b981e0f68e0faf9bb05d4a0e0fbb

URL: https://github.com/llvm/llvm-project/commit/48324f0f7b26b981e0f68e0faf9bb05d4a0e0fbb
DIFF: https://github.com/llvm/llvm-project/commit/48324f0f7b26b981e0f68e0faf9bb05d4a0e0fbb.diff

LOG: [ValueTracking] Combine variable declaration with its only assignment. NFC (#89526)

Added: 
    

Modified: 
    llvm/lib/Analysis/ValueTracking.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index c038f7eaabbb67..21e3f8a4cc52c7 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -2682,7 +2682,6 @@ static bool isKnownNonZeroFromOperator(const Operator *I,
     if (cast<PossiblyExactOperator>(I)->isExact())
       return isKnownNonZero(I->getOperand(0), DemandedElts, Q, Depth);
 
-    std::optional<bool> XUgeY;
     KnownBits XKnown =
         computeKnownBits(I->getOperand(0), DemandedElts, Depth, Q);
     // If X is fully unknown we won't be able to figure anything out so don't
@@ -2698,7 +2697,7 @@ static bool isKnownNonZeroFromOperator(const Operator *I,
       YKnown = YKnown.abs(/*IntMinIsPoison*/ false);
     }
     // If X u>= Y then div is non zero (0/0 is UB).
-    XUgeY = KnownBits::uge(XKnown, YKnown);
+    std::optional<bool> XUgeY = KnownBits::uge(XKnown, YKnown);
     // If X is total unknown or X u< Y we won't be able to prove non-zero
     // with compute known bits so just return early.
     return XUgeY && *XUgeY;


        


More information about the llvm-commits mailing list