aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/PredicateInfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/Utils/PredicateInfo.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/PredicateInfo.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/PredicateInfo.cpp b/llvm/lib/Transforms/Utils/PredicateInfo.cpp
index 02420fa..38a312a 100644
--- a/llvm/lib/Transforms/Utils/PredicateInfo.cpp
+++ b/llvm/lib/Transforms/Utils/PredicateInfo.cpp
@@ -370,6 +370,8 @@ void PredicateInfoBuilder::processAssume(
Values.push_back(Cond);
if (auto *Cmp = dyn_cast<CmpInst>(Cond))
collectCmpOps(Cmp, Values);
+ else if (match(Cond, m_NUWTrunc(m_Value(Op0))))
+ Values.push_back(Op0);
for (Value *V : Values) {
if (shouldRename(V)) {
@@ -416,6 +418,8 @@ void PredicateInfoBuilder::processBranch(
Values.push_back(Cond);
if (auto *Cmp = dyn_cast<CmpInst>(Cond))
collectCmpOps(Cmp, Values);
+ else if (match(Cond, m_NUWTrunc(m_Value(Op0))))
+ Values.push_back(Op0);
for (Value *V : Values) {
if (shouldRename(V)) {
@@ -709,6 +713,11 @@ std::optional<PredicateConstraint> PredicateBase::getConstraint() const {
: ConstantInt::getFalse(Condition->getType())}};
}
+ if (match(Condition, m_NUWTrunc(m_Specific(RenamedOp)))) {
+ return {{TrueEdge ? CmpInst::ICMP_NE : CmpInst::ICMP_EQ,
+ ConstantInt::getNullValue(RenamedOp->getType())}};
+ }
+
CmpInst *Cmp = dyn_cast<CmpInst>(Condition);
if (!Cmp) {
// TODO: Make this an assertion once RenamedOp is fully accurate.