mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-02 22:23:10 +00:00
Teach the verifier to enforce that the alignment argument of memory intrinsics must be a power of 2.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230941 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -2796,14 +2796,20 @@ void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) {
|
||||
} break;
|
||||
case Intrinsic::memcpy:
|
||||
case Intrinsic::memmove:
|
||||
case Intrinsic::memset:
|
||||
Assert1(isa<ConstantInt>(CI.getArgOperand(3)),
|
||||
case Intrinsic::memset: {
|
||||
ConstantInt *AlignCI = dyn_cast<ConstantInt>(CI.getArgOperand(3));
|
||||
Assert1(AlignCI,
|
||||
"alignment argument of memory intrinsics must be a constant int",
|
||||
&CI);
|
||||
const APInt &AlignVal = AlignCI->getValue();
|
||||
Assert1(AlignCI->isZero() || AlignVal.isPowerOf2(),
|
||||
"alignment argument of memory intrinsics must be a power of 2",
|
||||
&CI);
|
||||
Assert1(isa<ConstantInt>(CI.getArgOperand(4)),
|
||||
"isvolatile argument of memory intrinsics must be a constant int",
|
||||
&CI);
|
||||
break;
|
||||
}
|
||||
case Intrinsic::gcroot:
|
||||
case Intrinsic::gcwrite:
|
||||
case Intrinsic::gcread:
|
||||
|
||||
Reference in New Issue
Block a user