Skip to content

Commit

Permalink
Extend some pointer type checks to cover vectors.
Browse files Browse the repository at this point in the history
  • Loading branch information
maleadt committed Apr 18, 2024
1 parent 6acd362 commit 51e4492
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/llvm-gc-invariant-verifier.cpp
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand All @@ -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,
Expand All @@ -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))
Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/llvm-propagate-addrspaces.cpp
Expand Up @@ -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.
Expand Down

0 comments on commit 51e4492

Please sign in to comment.