aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib
diff options
context:
space:
mode:
authorPaul Walker <paul.walker@arm.com>2023-10-18 10:40:07 +0100
committerGitHub <noreply@github.com>2023-10-18 10:40:07 +0100
commit675231eb09ca37a8b76f748c0b73a1e26604ff20 (patch)
tree75db7eb791bc8d579ea842a0f16c727dfdcfe22f /llvm/lib
parent975ec8368fcb3f9157481e78f10e589a38915116 (diff)
downloadllvm-675231eb09ca37a8b76f748c0b73a1e26604ff20.zip
llvm-675231eb09ca37a8b76f748c0b73a1e26604ff20.tar.gz
llvm-675231eb09ca37a8b76f748c0b73a1e26604ff20.tar.bz2
[SVE ACLE] Allow default zero initialisation for svcount_t. (#69321)
This matches the behaviour of the other SVE ACLE types.
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp6
-rw-r--r--llvm/lib/IR/Type.cpp3
2 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 4bb0ba6..eabc763 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -1738,6 +1738,12 @@ SDValue SelectionDAGBuilder::getValueImpl(const Value *V) {
if (const auto *NC = dyn_cast<NoCFIValue>(C))
return getValue(NC->getGlobalValue());
+ if (VT == MVT::aarch64svcount) {
+ assert(C->isNullValue() && "Can only zero this target type!");
+ return DAG.getNode(ISD::BITCAST, getCurSDLoc(), VT,
+ DAG.getConstant(0, getCurSDLoc(), MVT::nxv16i1));
+ }
+
VectorType *VecTy = cast<VectorType>(V->getType());
// Now that we know the number and type of the elements, get that number of
diff --git a/llvm/lib/IR/Type.cpp b/llvm/lib/IR/Type.cpp
index 97febcd..006278d 100644
--- a/llvm/lib/IR/Type.cpp
+++ b/llvm/lib/IR/Type.cpp
@@ -841,7 +841,8 @@ static TargetTypeInfo getTargetTypeInfo(const TargetExtType *Ty) {
// Opaque types in the AArch64 name space.
if (Name == "aarch64.svcount")
- return TargetTypeInfo(ScalableVectorType::get(Type::getInt1Ty(C), 16));
+ return TargetTypeInfo(ScalableVectorType::get(Type::getInt1Ty(C), 16),
+ TargetExtType::HasZeroInit);
return TargetTypeInfo(Type::getVoidTy(C));
}