mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
Add atomicrmw operation to error messages
llvm-svn: 343656
This commit is contained in:
parent
0cc3eb8f8b
commit
5b42061214
@ -6724,8 +6724,13 @@ int LLParser::ParseAtomicRMW(Instruction *&Inst, PerFunctionState &PFS) {
|
||||
return Error(PtrLoc, "atomicrmw operand must be a pointer");
|
||||
if (cast<PointerType>(Ptr->getType())->getElementType() != Val->getType())
|
||||
return Error(ValLoc, "atomicrmw value and pointer type do not match");
|
||||
if (!Val->getType()->isIntegerTy())
|
||||
return Error(ValLoc, "atomicrmw operand must be an integer");
|
||||
|
||||
if (!Val->getType()->isIntegerTy()) {
|
||||
return Error(ValLoc, "atomicrmw " +
|
||||
AtomicRMWInst::getOperationName(Operation) +
|
||||
" operand must be an integer");
|
||||
}
|
||||
|
||||
unsigned Size = Val->getType()->getPrimitiveSizeInBits();
|
||||
if (Size < 8 || (Size & (Size - 1)))
|
||||
return Error(ValLoc, "atomicrmw operand must be power-of-two byte-sized"
|
||||
|
@ -3348,17 +3348,19 @@ void Verifier::visitAtomicRMWInst(AtomicRMWInst &RMWI) {
|
||||
"atomicrmw instructions must be atomic.", &RMWI);
|
||||
Assert(RMWI.getOrdering() != AtomicOrdering::Unordered,
|
||||
"atomicrmw instructions cannot be unordered.", &RMWI);
|
||||
auto Op = RMWI.getOperation();
|
||||
PointerType *PTy = dyn_cast<PointerType>(RMWI.getOperand(0)->getType());
|
||||
Assert(PTy, "First atomicrmw operand must be a pointer.", &RMWI);
|
||||
Type *ElTy = PTy->getElementType();
|
||||
Assert(ElTy->isIntegerTy(), "atomicrmw operand must have integer type!",
|
||||
Assert(ElTy->isIntegerTy(), "atomicrmw " +
|
||||
AtomicRMWInst::getOperationName(Op) +
|
||||
" operand must have integer type!",
|
||||
&RMWI, ElTy);
|
||||
checkAtomicMemAccessSize(ElTy, &RMWI);
|
||||
Assert(ElTy == RMWI.getOperand(1)->getType(),
|
||||
"Argument value type does not match pointer operand type!", &RMWI,
|
||||
ElTy);
|
||||
Assert(AtomicRMWInst::FIRST_BINOP <= RMWI.getOperation() &&
|
||||
RMWI.getOperation() <= AtomicRMWInst::LAST_BINOP,
|
||||
Assert(AtomicRMWInst::FIRST_BINOP <= Op && Op <= AtomicRMWInst::LAST_BINOP,
|
||||
"Invalid binary operation!", &RMWI);
|
||||
visitInstruction(RMWI);
|
||||
}
|
||||
|
@ -0,0 +1,7 @@
|
||||
; RUN: not llvm-as -disable-output %s 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK: error: atomicrmw add operand must be an integer
|
||||
define void @f(float* %ptr) {
|
||||
atomicrmw add float* %ptr, float 1.0 seq_cst
|
||||
ret void
|
||||
}
|
Loading…
Reference in New Issue
Block a user