aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/CodeGenPrepare.cpp
diff options
context:
space:
mode:
authorJoshua Cranmer <joshua.cranmer@intel.com>2023-05-23 15:00:19 -0400
committerJoshua Cranmer <joshua.cranmer@intel.com>2023-05-23 15:02:03 -0400
commit3ac1cef8665935140f10ac1db8fbc587b56dcfa8 (patch)
tree4fa05f2f43111131368350da51dd083d786f0dc0 /llvm/lib/CodeGen/CodeGenPrepare.cpp
parent2622b2f409f7a7a51f11d5eab3976785b47c1a7b (diff)
downloadllvm-3ac1cef8665935140f10ac1db8fbc587b56dcfa8.zip
llvm-3ac1cef8665935140f10ac1db8fbc587b56dcfa8.tar.gz
llvm-3ac1cef8665935140f10ac1db8fbc587b56dcfa8.tar.bz2
[CodeGen] Fix crash in CodeGenPrepare::optimizeGatherScatterInst.
Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D151141
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r--llvm/lib/CodeGen/CodeGenPrepare.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index 3e8d0a4..d806c7c 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -5708,7 +5708,8 @@ bool CodeGenPrepare::optimizeGatherScatterInst(Instruction *MemoryInst,
// Create a scalar GEP if there are more than 2 operands.
if (Ops.size() != 2) {
// Replace the last index with 0.
- Ops[FinalIndex] = Constant::getNullValue(ScalarIndexTy);
+ Ops[FinalIndex] =
+ Constant::getNullValue(Ops[FinalIndex]->getType()->getScalarType());
Base = Builder.CreateGEP(SourceTy, Base, ArrayRef(Ops).drop_front());
SourceTy = GetElementPtrInst::getIndexedType(
SourceTy, ArrayRef(Ops).drop_front());