[llvm] dd7d610 - [ValueTracking] Let isGuaranteedToBeUndefOrPoison look into operands of icmp

Juneyoung Lee via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 4 00:16:49 PST 2020


Author: Juneyoung Lee
Date: 2020-02-04T17:16:32+09:00
New Revision: dd7d61026277006df5a200cf9ff6ceb5f6594e03

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

LOG: [ValueTracking] Let isGuaranteedToBeUndefOrPoison look into operands of icmp

Added: 
    

Modified: 
    llvm/lib/Analysis/ValueTracking.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 6b88cd05b2d7..5b4c8102863c 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -4529,6 +4529,13 @@ bool llvm::isGuaranteedNotToBeUndefOrPoison(const Value *V) {
       return true;
   }
 
+  if (auto II = dyn_cast<ICmpInst>(V)) {
+    if (llvm::all_of(II->operands(), [](const Value *V) {
+          return isGuaranteedNotToBeUndefOrPoison(V);
+        }))
+      return true;
+  }
+
   return false;
 }
 


        


More information about the llvm-commits mailing list