diff options
author | Philip Reames <listmail@philipreames.com> | 2021-10-27 10:51:03 -0700 |
---|---|---|
committer | Philip Reames <listmail@philipreames.com> | 2021-10-27 11:25:40 -0700 |
commit | 425cbbc602c970e20785e005a7c9d5716a5fac68 (patch) | |
tree | 250cf2269a8a308f6f51ec5eb4967720d86086d7 /llvm/lib/Analysis/ValueTracking.cpp | |
parent | f06e33298266b46985ebd6612cde587c27e1ef1a (diff) | |
download | llvm-425cbbc602c970e20785e005a7c9d5716a5fac68.zip llvm-425cbbc602c970e20785e005a7c9d5716a5fac68.tar.gz llvm-425cbbc602c970e20785e005a7c9d5716a5fac68.tar.bz2 |
[Operator] Add hasPoisonGeneratingFlags [mostly NFC]
This method parallels the dropPoisonGeneratingFlags on Instruction, but is hoisted to operator to handle constant expressions as well.
This is mostly code movement, but I did go ahead and add the inrange constexpr gep case. This had been discussed previously, but apparently never followed up o.
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index c641652..9a87227 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -4963,19 +4963,9 @@ bool llvm::isOverflowIntrinsicNoWrap(const WithOverflowInst *WO, static bool canCreateUndefOrPoison(const Operator *Op, bool PoisonOnly, bool ConsiderFlags) { - if (ConsiderFlags) { - // See whether I has flags that may create poison - if (const auto *OvOp = dyn_cast<OverflowingBinaryOperator>(Op)) { - if (OvOp->hasNoSignedWrap() || OvOp->hasNoUnsignedWrap()) - return true; - } - if (const auto *ExactOp = dyn_cast<PossiblyExactOperator>(Op)) - if (ExactOp->isExact()) - return true; - if (const auto *GEP = dyn_cast<GEPOperator>(Op)) - if (GEP->isInBounds()) - return true; - } + + if (ConsiderFlags && Op->hasPoisonGeneratingFlags()) + return true; // TODO: this should really be under the ConsiderFlags block, but currently // these are not dropped by dropPoisonGeneratingFlags |