[PATCH] D81620: [SVE] Allow scalable vector splats to be gep indices
Christopher Tetreault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 23 15:39:05 PDT 2020
ctetreau updated this revision to Diff 272845.
ctetreau edited the summary of this revision.
ctetreau added a comment.
Split getSplatVal stuff into its own commit, rebase
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D81620/new/
https://reviews.llvm.org/D81620
Files:
llvm/lib/IR/Constants.cpp
llvm/lib/IR/Instructions.cpp
llvm/test/Transforms/InstSimplify/gep.ll
Index: llvm/test/Transforms/InstSimplify/gep.ll
===================================================================
--- llvm/test/Transforms/InstSimplify/gep.ll
+++ llvm/test/Transforms/InstSimplify/gep.ll
@@ -176,4 +176,12 @@
ret <vscale x 4 x float*> %gep
}
+define <vscale x 4 x float*> @scalable_vector_idx_vector() {
+; CHECK-LABEL: @scalable_vector_idx_mix_scalar_vector(
+; CHECK-NEXT: ret <vscale x 4 x float*> getelementptr (%struct, <vscale x 4 x %struct*> zeroinitializer, <vscale x 4 x i64> zeroinitializer, <vscale x 4 x i32> shufflevector (<vscale x 4 x i32> insertelement (<vscale x 4 x i32> undef, i32 1, i32 0), <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer))
+;
+ %gep = getelementptr %struct, <vscale x 4 x %struct*> zeroinitializer, i32 0, <vscale x 4 x i32> shufflevector (<vscale x 4 x i32> insertelement (<vscale x 4 x i32> undef, i32 1, i32 0), <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer)
+ ret <vscale x 4 x float*> %gep
+}
+
; Check ConstantExpr::getGetElementPtr() using ElementCount for size queries - end.
Index: llvm/lib/IR/Instructions.cpp
===================================================================
--- llvm/lib/IR/Instructions.cpp
+++ llvm/lib/IR/Instructions.cpp
@@ -3220,7 +3220,7 @@
// FIXME: Check address space sizes here
if (VectorType *SrcVecTy = dyn_cast<VectorType>(SrcTy))
if (VectorType *DestVecTy = dyn_cast<VectorType>(DestTy))
- if (SrcVecTy->getNumElements() == DestVecTy->getNumElements()) {
+ if (SrcVecTy->getElementCount() == DestVecTy->getElementCount()) {
// An element by element cast. Find the appropriate opcode based on the
// element types.
SrcTy = SrcVecTy->getElementType();
Index: llvm/lib/IR/Constants.cpp
===================================================================
--- llvm/lib/IR/Constants.cpp
+++ llvm/lib/IR/Constants.cpp
@@ -1572,9 +1572,8 @@
const APInt &Constant::getUniqueInteger() const {
if (const ConstantInt *CI = dyn_cast<ConstantInt>(this))
return CI->getValue();
- assert(this->getSplatValue() && "Doesn't contain a unique integer!");
- const Constant *C = this->getAggregateElement(0U);
- assert(C && isa<ConstantInt>(C) && "Not a vector of numbers!");
+ Constant *C = this->getSplatValue();
+ assert(C && isa<ConstantInt>(C) && "Doesn't contain a unique integer!");
return cast<ConstantInt>(C)->getValue();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81620.272845.patch
Type: text/x-patch
Size: 2419 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200623/5a451ea5/attachment.bin>
More information about the llvm-commits
mailing list