aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
diff options
context:
space:
mode:
authorRoman Lebedev <lebedev.ri@gmail.com>2020-10-12 11:00:52 +0300
committerRoman Lebedev <lebedev.ri@gmail.com>2020-10-12 11:04:03 +0300
commit1c021c64caef83cccb719c9bf0a2554faa6563af (patch)
tree9838ab889be47b38cd937b828f5678f3e3a4fea6 /llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
parentc5ba0d33cc060cc06a28a5d9101060afd1c0ee9a (diff)
downloadllvm-1c021c64caef83cccb719c9bf0a2554faa6563af.zip
llvm-1c021c64caef83cccb719c9bf0a2554faa6563af.tar.gz
llvm-1c021c64caef83cccb719c9bf0a2554faa6563af.tar.bz2
[SCEV] Model ptrtoint(SCEVUnknown) cast not as unknown, but as zext/trunc/self of SCEVUnknown
While we indeed can't treat them as no-ops, i believe we can/should do better than just modelling them as `unknown`. `inttoptr` story is complicated, but for `ptrtoint`, it seems straight-forward to model it just as a zext-or-trunc of unknown. This may be important now that we track towards making inttoptr/ptrtoint casts not no-op, and towards preventing folding them into loads/etc (see D88979/D88789/D88788) Reviewed By: mkazantsev Differential Revision: https://reviews.llvm.org/D88806
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyIndVar.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyIndVar.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
index 2d71b0f..3e280a6 100644
--- a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
@@ -427,7 +427,7 @@ static bool willNotOverflow(ScalarEvolution *SE, Instruction::BinaryOps BinOp,
: &ScalarEvolution::getZeroExtendExpr;
// Check ext(LHS op RHS) == ext(LHS) op ext(RHS)
- auto *NarrowTy = cast<IntegerType>(LHS->getType());
+ auto *NarrowTy = cast<IntegerType>(SE->getEffectiveSCEVType(LHS->getType()));
auto *WideTy =
IntegerType::get(NarrowTy->getContext(), NarrowTy->getBitWidth() * 2);