[PATCH] D137567: [SLP][NFC] Restructure getInsertIndex
krishna chaitanya sankisa via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 7 19:35:21 PST 2022
skc7 updated this revision to Diff 473857.
skc7 added a comment.
changes as per review suggestion.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137567/new/
https://reviews.llvm.org/D137567
Files:
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
Index: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
===================================================================
--- llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -290,15 +290,17 @@
unsigned Offset = 0) {
int Index = Offset;
if (const auto *IE = dyn_cast<InsertElementInst>(InsertInst)) {
- 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;
- }
- return None;
+ 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;
}
const auto *IV = cast<InsertValueInst>(InsertInst);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137567.473857.patch
Type: text/x-patch
Size: 1143 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221108/031e6262/attachment.bin>
More information about the llvm-commits
mailing list