[llvm] a3e8e86 - [LVI] Don't push both sides of and/or at once

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 2 02:29:46 PST 2024


Author: Nikita Popov
Date: 2024-01-02T11:28:48+01:00
New Revision: a3e8e86fb6ad27fe070bb2c0f54a1c697c665f13

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

LOG: [LVI] Don't push both sides of and/or at once

Same as the change in d5db2cdb22ab302acbb6e1a066e791f25dc612de,
but for condition handling. The same issue could occur here as well.

Added: 
    

Modified: 
    llvm/lib/Analysis/LazyValueInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/LazyValueInfo.cpp b/llvm/lib/Analysis/LazyValueInfo.cpp
index c94e29cabc3fe0..360fc594ef7ca3 100644
--- a/llvm/lib/Analysis/LazyValueInfo.cpp
+++ b/llvm/lib/Analysis/LazyValueInfo.cpp
@@ -1283,9 +1283,11 @@ LazyValueInfoImpl::getValueFromCondition(Value *Val, Value *Cond,
 
   std::optional<ValueLatticeElement> LV =
       getValueFromCondition(Val, L, IsTrueDest, UseBlockValue, Depth);
+  if (!LV)
+    return std::nullopt;
   std::optional<ValueLatticeElement> RV =
       getValueFromCondition(Val, R, IsTrueDest, UseBlockValue, Depth);
-  if (!LV || !RV)
+  if (!RV)
     return std::nullopt;
 
   // if (L && R) -> intersect L and R


        


More information about the llvm-commits mailing list