[PATCH] D137567: [SLP][NFC] Restructure getInsertIndex
Alexey Bataev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 7 10:01:29 PST 2022
ABataev added inline comments.
================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:293-301
if (const auto *CI = dyn_cast<ConstantInt>(IE->getOperand(2))) {
- auto *VT = cast<FixedVectorType>(IE->getType());
- if (CI->getValue().uge(VT->getNumElements()))
- return None;
- Index *= VT->getNumElements();
- Index += CI->getZExtValue();
- return Index;
+ if (const auto *VT = dyn_cast<FixedVectorType>(IE->getType())) {
+ if (CI->getValue().uge(VT->getNumElements()))
+ return None;
+ Index *= VT->getNumElements();
+ Index += CI->getZExtValue();
+ return Index;
----------------
Could you simplify it?
```
const auto *VT = dyn_cast<FixedVectorType>(IE->getType());
if (!VT)
return None;
const auto *CI = dyn_cast<ConstantInt>(IE->getOperand(2));
if (!CI)
return None;
if (CI->getValue().uge(VT->getNumElements()))
return None;
Index *= VT->getNumElements();
Index += CI->getZExtValue();
return Index;
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137567/new/
https://reviews.llvm.org/D137567
More information about the llvm-commits
mailing list