@@ -4224,6 +4224,33 @@ void Verifier::visitLoadInst(LoadInst &LI) {
42244224 visitInstruction (LI);
42254225}
42264226
4227+ static bool isConstantAddressSpace (unsigned AS) {
4228+ switch (AS) {
4229+ using namespace AMDGPUAS ;
4230+ case CONSTANT_ADDRESS:
4231+ case CONSTANT_ADDRESS_32BIT:
4232+ case CONSTANT_BUFFER_0:
4233+ case CONSTANT_BUFFER_1:
4234+ case CONSTANT_BUFFER_2:
4235+ case CONSTANT_BUFFER_3:
4236+ case CONSTANT_BUFFER_4:
4237+ case CONSTANT_BUFFER_5:
4238+ case CONSTANT_BUFFER_6:
4239+ case CONSTANT_BUFFER_7:
4240+ case CONSTANT_BUFFER_8:
4241+ case CONSTANT_BUFFER_9:
4242+ case CONSTANT_BUFFER_10:
4243+ case CONSTANT_BUFFER_11:
4244+ case CONSTANT_BUFFER_12:
4245+ case CONSTANT_BUFFER_13:
4246+ case CONSTANT_BUFFER_14:
4247+ case CONSTANT_BUFFER_15:
4248+ return true ;
4249+ default :
4250+ return false ;
4251+ }
4252+ }
4253+
42274254void Verifier::visitStoreInst (StoreInst &SI) {
42284255 PointerType *PTy = dyn_cast<PointerType>(SI.getOperand (1 )->getType ());
42294256 Check (PTy, " Store operand must be a pointer." , &SI);
@@ -4246,6 +4273,10 @@ void Verifier::visitStoreInst(StoreInst &SI) {
42464273 Check (SI.getSyncScopeID () == SyncScope::System,
42474274 " Non-atomic store cannot have SynchronizationScope specified" , &SI);
42484275 }
4276+ if (TT.isAMDGPU ()) {
4277+ Check (!isConstantAddressSpace (SI.getPointerAddressSpace ()),
4278+ " Store cannot be to constant addrspace" , &SI);
4279+ }
42494280 visitInstruction (SI);
42504281}
42514282
0 commit comments