diff --git a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp --- a/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp +++ b/llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp @@ -1164,13 +1164,21 @@ #ifndef NDEBUG Value *OldBase = BlockToValue[InBB]; Value *Base = getBaseForInput(InVal, nullptr); + + // We can't use `stripPointerCasts` instead of this function because + // `stripPointerCasts` doesn't handle vectors of pointers. + auto StripBitCasts = [](Value *V) -> Value * { + while (auto *BC = dyn_cast(V)) + V = BC->getOperand(0); + return V; + }; // In essence this assert states: the only way two values // incoming from the same basic block may be different is by // being different bitcasts of the same value. A cleanup // that remains TODO is changing findBaseOrBDV to return an // llvm::Value of the correct type (and still remain pure). // This will remove the need to add bitcasts. - assert(Base->stripPointerCasts() == OldBase->stripPointerCasts() && + assert(StripBitCasts(Base) == StripBitCasts(OldBase) && "findBaseOrBDV should be pure!"); #endif } diff --git a/llvm/test/Transforms/RewriteStatepointsForGC/phi-vector-bitcast.ll b/llvm/test/Transforms/RewriteStatepointsForGC/phi-vector-bitcast.ll --- a/llvm/test/Transforms/RewriteStatepointsForGC/phi-vector-bitcast.ll +++ b/llvm/test/Transforms/RewriteStatepointsForGC/phi-vector-bitcast.ll @@ -1,4 +1,3 @@ -; XFAIL: * ; REQUIRES: asserts ; RUN: opt < %s -disable-output -passes=rewrite-statepoints-for-gc