[llvm] e6f31f4 - [InstCombine] Use GEP type instead of pointee type
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 28 05:58:32 PST 2021
Author: Nikita Popov
Date: 2021-12-28T14:57:43+01:00
New Revision: e6f31f4e51df484e2f34c6c9cfd8d791cdee2eb0
URL: https://github.com/llvm/llvm-project/commit/e6f31f4e51df484e2f34c6c9cfd8d791cdee2eb0
DIFF: https://github.com/llvm/llvm-project/commit/e6f31f4e51df484e2f34c6c9cfd8d791cdee2eb0.diff
LOG: [InstCombine] Use GEP type instead of pointee type
The GEP source type is independent of whether it is a scalar or
vector GEP, as such we can simply preserve it.
Added:
Modified:
llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
index c6a4602e59e3e..736cf9c825d58 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
@@ -495,8 +495,7 @@ Instruction *InstCombinerImpl::visitExtractElementInst(ExtractElementInst &EI) {
}
GetElementPtrInst *NewGEP = GetElementPtrInst::Create(
- cast<PointerType>(NewPtr->getType())->getElementType(), NewPtr,
- NewOps);
+ GEP->getSourceElementType(), NewPtr, NewOps);
NewGEP->setIsInBounds(GEP->isInBounds());
return NewGEP;
}
More information about the llvm-commits
mailing list