From 51e4492161bf89892eb645320c69e59f714d7ae3 Mon Sep 17 00:00:00 2001 From: Tim Besard Date: Thu, 18 Apr 2024 11:06:31 +0200 Subject: [PATCH] Extend some pointer type checks to cover vectors. --- src/llvm-gc-invariant-verifier.cpp | 12 ++++++------ src/llvm-propagate-addrspaces.cpp | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/llvm-gc-invariant-verifier.cpp b/src/llvm-gc-invariant-verifier.cpp index 6245cb0708423..5badbca807569 100644 --- a/src/llvm-gc-invariant-verifier.cpp +++ b/src/llvm-gc-invariant-verifier.cpp @@ -78,7 +78,7 @@ void GCInvariantVerifier::visitAddrSpaceCastInst(AddrSpaceCastInst &I) { } void GCInvariantVerifier::checkStoreInst(Type *VTy, unsigned AS, Value &SI) { - if (VTy->isPointerTy()) { + if (VTy->isPtrOrPtrVectorTy()) { /* We currently don't obey this for arguments. That's ok - they're externally rooted. */ unsigned AS = VTy->getPointerAddressSpace(); @@ -107,14 +107,14 @@ void GCInvariantVerifier::visitAtomicCmpXchgInst(AtomicCmpXchgInst &SI) { void GCInvariantVerifier::visitLoadInst(LoadInst &LI) { Type *Ty = LI.getType(); - if (Ty->isPointerTy()) { + if (Ty->isPtrOrPtrVectorTy()) { unsigned AS = Ty->getPointerAddressSpace(); Check(AS != AddressSpace::CalleeRooted && AS != AddressSpace::Derived, "Illegal load of gc relevant value", &LI); } Ty = LI.getPointerOperand()->getType(); - if (Ty->isPointerTy()) { + if (Ty->isPtrOrPtrVectorTy()) { unsigned AS = Ty->getPointerAddressSpace(); Check(AS != AddressSpace::CalleeRooted, "Illegal load of callee rooted value", &LI); @@ -129,7 +129,7 @@ void GCInvariantVerifier::visitReturnInst(ReturnInst &RI) { if (!RI.getReturnValue()) return; Type *RTy = RI.getReturnValue()->getType(); - if (!RTy->isPointerTy()) + if (!RTy->isPtrOrPtrVectorTy()) return; unsigned AS = RTy->getPointerAddressSpace(); Check(!isSpecialAS(AS) || AS == AddressSpace::Tracked, @@ -138,7 +138,7 @@ void GCInvariantVerifier::visitReturnInst(ReturnInst &RI) { void GCInvariantVerifier::visitGetElementPtrInst(GetElementPtrInst &GEP) { Type *Ty = GEP.getType(); - if (!Ty->isPointerTy()) + if (!Ty->isPtrOrPtrVectorTy()) return; unsigned AS = Ty->getPointerAddressSpace(); if (!isSpecialAS(AS)) @@ -170,7 +170,7 @@ void GCInvariantVerifier::visitCallInst(CallInst &CI) { continue; } Type *Ty = Arg->getType(); - Check(Ty->isPointerTy() && + Check(Ty->isPtrOrPtrVectorTy() && Ty->getPointerAddressSpace() == AddressSpace::Tracked, "Invalid derived pointer in jlcall", &CI); } diff --git a/src/llvm-propagate-addrspaces.cpp b/src/llvm-propagate-addrspaces.cpp index 7c51fac5e1bd5..485eabefb5f8b 100644 --- a/src/llvm-propagate-addrspaces.cpp +++ b/src/llvm-propagate-addrspaces.cpp @@ -139,7 +139,7 @@ Value *PropagateJuliaAddrspacesVisitor::LiftPointer(Module *M, Value *V, Instruc break; } else { // Ok, we've reached a leaf - check if it is eligible for lifting - if (!CurrentV->getType()->isPointerTy() || + if (!CurrentV->getType()->isPtrOrPtrVectorTy() || isSpecialAS(getValueAddrSpace(CurrentV))) { // If not, poison all (recursive) users of this value, to prevent // looking at them again in future iterations.