[llvm] IVDescriptors: clarify getSCEV use in a function (NFC) (PR #106222)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 27 06:31:33 PDT 2024
https://github.com/artagnon created https://github.com/llvm/llvm-project/pull/106222
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.
>From c47c4fe048e381029c6b1db2825cb9bb39928f0b Mon Sep 17 00:00:00 2001
From: Ramkumar Ramachandra <ramkumar.ramachandra at codasip.com>
Date: Tue, 27 Aug 2024 14:26:03 +0100
Subject: [PATCH] IVDescriptors: clarify getSCEV use in a function (NFC)
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.
---
llvm/lib/Analysis/IVDescriptors.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
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.
More information about the llvm-commits
mailing list