[llvm] IVDescriptors: clarify getSCEV use in a function (NFC) (PR #106222)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 27 06:32:02 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-analysis
Author: Ramkumar Ramachandra (artagnon)
<details>
<summary>Changes</summary>
getSCEV will assert unless the operand is SCEVable. Replace an instance of the implementation of ScalarEvolution::isSCEVable (which checks that the operand is either integer or pointer type) with a call to the function, to make it clear that the subsequent use of getSCEV will not fail.
---
Full diff: https://github.com/llvm/llvm-project/pull/106222.diff
1 Files Affected:
- (modified) llvm/lib/Analysis/IVDescriptors.cpp (+2-2)
``````````diff
diff --git a/llvm/lib/Analysis/IVDescriptors.cpp b/llvm/lib/Analysis/IVDescriptors.cpp
index ac6df226784345..f5258601fd5d49 100644
--- a/llvm/lib/Analysis/IVDescriptors.cpp
+++ b/llvm/lib/Analysis/IVDescriptors.cpp
@@ -1479,8 +1479,8 @@ bool InductionDescriptor::isInductionPHI(
InductionDescriptor &D, const SCEV *Expr,
SmallVectorImpl<Instruction *> *CastsToIgnore) {
Type *PhiTy = Phi->getType();
- // We only handle integer and pointer inductions variables.
- if (!PhiTy->isIntegerTy() && !PhiTy->isPointerTy())
+ // isSCEVable returns true for integer and pointer types.
+ if (!SE->isSCEVable(PhiTy))
return false;
// Check that the PHI is consecutive.
``````````
</details>
https://github.com/llvm/llvm-project/pull/106222
More information about the llvm-commits
mailing list