diff options
author | Florian Hahn <flo@fhahn.com> | 2020-07-24 17:28:01 +0100 |
---|---|---|
committer | Florian Hahn <flo@fhahn.com> | 2020-07-24 17:37:09 +0100 |
commit | 1c7c69c795b22d73d038dd9b49de921cfd9d3468 (patch) | |
tree | 2bebfbfed8a1dfa7ebb33bc69994b658ed8439a8 /llvm/lib/Analysis/ValueTracking.cpp | |
parent | 22c16360dd00230987fee5f6f3c57f8071144cc1 (diff) | |
download | llvm-1c7c69c795b22d73d038dd9b49de921cfd9d3468.zip llvm-1c7c69c795b22d73d038dd9b49de921cfd9d3468.tar.gz llvm-1c7c69c795b22d73d038dd9b49de921cfd9d3468.tar.bz2 |
[ValueTracking] Check for ConstantExpr before using recursive helpers.
Make sure we do not call
constainsConstantExpression/containsUndefElement on ConstantExpression,
which is not supported.
In particular, containsUndefElement/constainsConstantExpression are only
supported on constants which are supported by getAggregateElement.
Unfortunately there's no convenient way to check if a constant supports
getAggregateElement, so just check for non-constantexpressions with
vector type. Other users of those functions do so too.
Reviewers: spatel, nikic, craig.topper, lebedev.ri, jdoerfert, aqjune
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D84512
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index 0ab2a13..116916a 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -4794,8 +4794,8 @@ bool llvm::isGuaranteedNotToBeUndefOrPoison(const Value *V, isa<ConstantPointerNull>(C) || isa<Function>(C)) return true; - if (C->getType()->isVectorTy()) - return !C->containsUndefElement() && !C->containsConstantExpression(); + if (C->getType()->isVectorTy() && !isa<ConstantExpr>(C)) + return !C->containsConstantExpression() && !C->containsUndefElement(); } // Strip cast operations from a pointer value. |