From 92106641ae297c24877085e0357e8095aa7b43c9 Mon Sep 17 00:00:00 2001 From: Juneyoung Lee Date: Fri, 25 Sep 2020 09:49:13 +0900 Subject: [PATCH] [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. --- llvm/lib/Analysis/ValueTracking.cpp | 3 +++ 1 file changed, 3 insertions(+) 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(V)) + return false; + if (const auto *A = dyn_cast(V)) { if (A->hasAttribute(Attribute::NoUndef)) return true;