mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-21 03:05:26 -04:00
Verifier: Make sure masked load/store alignment is a power of 2
The same should also be done for scatter/gather, but the verifier doesn't check those at all now. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@356094 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
+6
-2
@@ -4500,11 +4500,13 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
|
||||
Call);
|
||||
|
||||
Value *Ptr = Call.getArgOperand(0);
|
||||
// Value *Alignment = Call.getArgOperand(1);
|
||||
ConstantInt *Alignment = cast<ConstantInt>(Call.getArgOperand(1));
|
||||
Value *Mask = Call.getArgOperand(2);
|
||||
Value *PassThru = Call.getArgOperand(3);
|
||||
Assert(Mask->getType()->isVectorTy(), "masked_load: mask must be vector",
|
||||
Call);
|
||||
Assert(Alignment->getValue().isPowerOf2(),
|
||||
"masked_load: alignment must be a power of 2", Call);
|
||||
|
||||
// DataTy is the overloaded type
|
||||
Type *DataTy = cast<PointerType>(Ptr->getType())->getElementType();
|
||||
@@ -4520,10 +4522,12 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
|
||||
case Intrinsic::masked_store: {
|
||||
Value *Val = Call.getArgOperand(0);
|
||||
Value *Ptr = Call.getArgOperand(1);
|
||||
// Value *Alignment = Call.getArgOperand(2);
|
||||
ConstantInt *Alignment = cast<ConstantInt>(Call.getArgOperand(2));
|
||||
Value *Mask = Call.getArgOperand(3);
|
||||
Assert(Mask->getType()->isVectorTy(), "masked_store: mask must be vector",
|
||||
Call);
|
||||
Assert(Alignment->getValue().isPowerOf2(),
|
||||
"masked_store: alignment must be a power of 2", Call);
|
||||
|
||||
// DataTy is the overloaded type
|
||||
Type *DataTy = cast<PointerType>(Ptr->getType())->getElementType();
|
||||
|
||||
Reference in New Issue
Block a user