[PATCH] D105510: [ScalarEvolution] Strictly enforce pointer/int type rules.
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 6 13:27:06 PDT 2021
efriedma created this revision.
efriedma added reviewers: reames, mkazantsev, nikic, lebedev.ri.
Herald added subscribers: javed.absar, hiraditya.
efriedma requested review of this revision.
Herald added a project: LLVM.
Rules:
1. SCEVUnknown is a pointer if and only if the LLVM IR value is a pointer.
2. SCEVPtrToInt is never a pointer.
3. If any other SCEV expression has no pointer operands, the result is an integer.
4. If a SCEVAddExpr has exactly one pointer operand, the result is a pointer.
5. If a SCEVAddRecExpr's first operand is a pointer, and it has no other pointer operands, the result is a pointer.
6. If a SCEVMinMaxExpr has all pointer operands, the result is a pointer.
7. Otherwise, the SCEV expression is invalid.
I'm not sure how useful rule 6 is in practice. If we exclude it, we can guarantee that ScalarEvolution::getPointerBase always returns a SCEVUnknown, which might be a helpful property. Anyway, I'll leave that for a followup.
This is basically mop-up at this point; all the changes with significant functional effects have landed. Some of the remaining changes could be split off, but I don't see much point.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D105510
Files:
llvm/lib/Analysis/ScalarEvolution.cpp
llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
llvm/unittests/Analysis/ScalarEvolutionTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105510.356813.patch
Type: text/x-patch
Size: 8753 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210706/346ff746/attachment.bin>
More information about the llvm-commits
mailing list