[llvm] [SCEV] Simplify getElementSz using getLoadStore-helpers (NFC) (PR #222908)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 13 11:36:11 PDT 2026
================
@@ -14026,20 +14026,12 @@ bool ScalarEvolution::containsErasedValue(const SCEV *S) const {
/// Return the size of an element read or written by Inst.
const SCEV *ScalarEvolution::getElementSize(Instruction *Inst) {
- Type *Ty;
- Type *PtrTy;
- if (StoreInst *Store = dyn_cast<StoreInst>(Inst)) {
- Ty = Store->getValueOperand()->getType();
- PtrTy = Store->getPointerOperandType();
- } else if (LoadInst *Load = dyn_cast<LoadInst>(Inst)) {
- Ty = Load->getType();
- PtrTy = Load->getPointerOperandType();
- } else {
+ if (!isa<LoadInst, StoreInst>(Inst))
return nullptr;
- }
-
- Type *ETy = getEffectiveSCEVType(PtrTy);
- return getSizeOfExpr(ETy, Ty);
+ Type *Ty = getLoadStoreType(Inst);
----------------
fhahn wrote:
nit: perhaps slightly clearer
```suggestion
Type *AccessTy = getLoadStoreType(Inst);
```
or maybe just inline below?
https://github.com/llvm/llvm-project/pull/222908
More information about the llvm-commits
mailing list