[PATCH] D146470: [LFTR] Assert and simplify under assumption exit counts are integers
Philip Reames via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 20 16:26:56 PDT 2023
reames created this revision.
reames added reviewers: nikic, efriedma.
Herald added subscribers: StephenFan, bollu, hiraditya, mcrosier.
Herald added a project: All.
reames requested review of this revision.
Herald added a project: LLVM.
This invariant was introduced in 8f3d16. This change should be entirely obvious; I'm posting for review just for a sanity check.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D146470
Files:
llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
Index: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -912,6 +912,7 @@
const SCEV *ExitCount, bool UsePostInc, Loop *L,
SCEVExpander &Rewriter, ScalarEvolution *SE) {
assert(isLoopCounter(IndVar, L, SE));
+ assert(ExitCount->getType()->isIntegerTy() && "exit count must be integer");
const SCEVAddRecExpr *AR = cast<SCEVAddRecExpr>(SE->getSCEV(IndVar));
const SCEV *IVInit = AR->getStart();
assert(AR->getStepRecurrence(*SE)->isOne() && "only handles unit stride");
@@ -920,8 +921,7 @@
// finds a valid pointer IV. Sign extend ExitCount in order to materialize a
// GEP. Avoid running SCEVExpander on a new pointer value, instead reusing
// the existing GEPs whenever possible.
- if (IndVar->getType()->isPointerTy() &&
- !ExitCount->getType()->isPointerTy()) {
+ if (IndVar->getType()->isPointerTy()) {
// IVOffset will be the new GEP offset that is interpreted by GEP as a
// signed value. ExitCount on the other hand represents the loop trip count,
// which is an unsigned value. FindLoopCounter only allows induction
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146470.506766.patch
Type: text/x-patch
Size: 1291 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230320/1d8a803f/attachment.bin>
More information about the llvm-commits
mailing list