[llvm] 9210664 - [ValueTracking] Make isGuaranteedNotToBeUndefOrPoison exit early when MetadataAsValue is given

Juneyoung Lee via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 24 17:51:23 PDT 2020


Author: Juneyoung Lee
Date: 2020-09-25T09:50:09+09:00
New Revision: 92106641ae297c24877085e0357e8095aa7b43c9

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

LOG: [ValueTracking] Make isGuaranteedNotToBeUndefOrPoison exit early when MetadataAsValue is given

It is set to conservatively return false, otherwise noundef attributes are added to function calls with metadata arguments.

Added: 
    

Modified: 
    llvm/lib/Analysis/ValueTracking.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 682baacac3a9..ac8386900a11 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -4881,6 +4881,9 @@ static bool isGuaranteedNotToBeUndefOrPoison(const Value *V,
   if (Depth >= MaxAnalysisRecursionDepth)
     return false;
 
+  if (isa<MetadataAsValue>(V))
+    return false;
+
   if (const auto *A = dyn_cast<Argument>(V)) {
     if (A->hasAttribute(Attribute::NoUndef))
       return true;


        


More information about the llvm-commits mailing list