aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
diff options
context:
space:
mode:
authorRoman Lebedev <lebedev.ri@gmail.com>2021-04-19 16:48:02 +0300
committerRoman Lebedev <lebedev.ri@gmail.com>2021-04-19 18:38:38 +0300
commit73f60e398890941521d55868705c0b539ed80f94 (patch)
treeea6b312b7572f1cef856ec4284d61e1d4f65e4ce /llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
parent016c5771b2cbf198b9bfe469634e5f301cc06083 (diff)
downloadllvm-73f60e398890941521d55868705c0b539ed80f94.zip
llvm-73f60e398890941521d55868705c0b539ed80f94.tar.gz
llvm-73f60e398890941521d55868705c0b539ed80f94.tar.bz2
[SCEVExpander] generateOverflowCheck(): explicitly PtrToInt the Start
Currently, InsertNoopCastOfTo() would implicitly insert that cast, but now that we have SCEVPtrToIntExpr, i'm hoping we could stop InsertNoopCastOfTo() from doing that. But first all users must be fixed.
Diffstat (limited to 'llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
index 2c9b4cb..4d70b91 100644
--- a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
+++ b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
@@ -2495,7 +2495,10 @@ Value *SCEVExpander::generateOverflowCheck(const SCEVAddRecExpr *AR,
Value *StepValue = expandCodeForImpl(Step, Ty, Loc, false);
Value *NegStepValue =
expandCodeForImpl(SE.getNegativeSCEV(Step), Ty, Loc, false);
- Value *StartValue = expandCodeForImpl(Start, ARExpandTy, Loc, false);
+ Value *StartValue = expandCodeForImpl(
+ isa<PointerType>(ARExpandTy) ? Start
+ : SE.getPtrToIntExpr(Start, ARExpandTy),
+ ARExpandTy, Loc, false);
ConstantInt *Zero =
ConstantInt::get(Loc->getContext(), APInt::getNullValue(DstBits));