Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/IR/Verifier.cpp
Show First 20 Lines • Show All 4,602 Lines • ▼ Show 20 Lines | for (auto &Elem : Call.bundle_op_infos()) { | ||||
Attribute::AttrKind Kind = | Attribute::AttrKind Kind = | ||||
Attribute::getAttrKindFromName(Elem.Tag->getKey()); | Attribute::getAttrKindFromName(Elem.Tag->getKey()); | ||||
unsigned ArgCount = Elem.End - Elem.Begin; | unsigned ArgCount = Elem.End - Elem.Begin; | ||||
if (Kind == Attribute::Alignment) { | if (Kind == Attribute::Alignment) { | ||||
Assert(ArgCount <= 3 && ArgCount >= 2, | Assert(ArgCount <= 3 && ArgCount >= 2, | ||||
"alignment assumptions should have 2 or 3 arguments"); | "alignment assumptions should have 2 or 3 arguments"); | ||||
Assert(Call.getOperand(Elem.Begin)->getType()->isPointerTy(), | Assert(Call.getOperand(Elem.Begin)->getType()->isPointerTy(), | ||||
"first argument should be a pointer"); | "first argument should be a pointer"); | ||||
Assert(Call.getOperand(Elem.Begin + 1)->getType()->isIntegerTy(), | Assert(Call.getOperand(Elem.Begin + 1)->getType()->isIntegerTy(), | ||||
"second argument should be an integer"); | "second argument should be an integer"); | ||||
ConstantInt *Alignment = dyn_cast<ConstantInt>(Call.getOperand(Elem.Begin + 1)); | |||||
Lint: Pre-merge checks: clang-format: please reformat the code
```
- ConstantInt *Alignment = dyn_cast<ConstantInt>… | |||||
if (Alignment) | |||||
Assert(Alignment->getValue().isPowerOf2(), | |||||
"alignment must be a power of 2", Call); | |||||
if (ArgCount == 3) | if (ArgCount == 3) | ||||
Assert(Call.getOperand(Elem.Begin + 2)->getType()->isIntegerTy(), | Assert(Call.getOperand(Elem.Begin + 2)->getType()->isIntegerTy(), | ||||
"third argument should be an integer if present"); | "third argument should be an integer if present"); | ||||
lebedev.riUnsubmitted Not Done ReplyInline Actions@jdoerfert Should second/third arguments be a *constant* integers ? lebedev.ri: @jdoerfert Should second/third arguments be a *constant* integers ?
| |||||
jdoerfertUnsubmitted Not Done ReplyInline ActionsRight now, I think so. I'd be fine if we later allow non-constants but that is a different story. jdoerfert: Right now, I think so. I'd be fine if we later allow non-constants but that is a different… | |||||
return; | return; | ||||
} | } | ||||
Assert(ArgCount <= 2, "to many arguments"); | Assert(ArgCount <= 2, "too many arguments"); | ||||
if (Kind == Attribute::None) | if (Kind == Attribute::None) | ||||
break; | break; | ||||
if (Attribute::isIntAttrKind(Kind)) { | if (Attribute::isIntAttrKind(Kind)) { | ||||
Assert(ArgCount == 2, "this attribute should have 2 arguments"); | Assert(ArgCount == 2, "this attribute should have 2 arguments"); | ||||
Assert(isa<ConstantInt>(Call.getOperand(Elem.Begin + 1)), | Assert(isa<ConstantInt>(Call.getOperand(Elem.Begin + 1)), | ||||
"the second argument should be a constant integral value"); | "the second argument should be a constant integral value"); | ||||
} else if (Attribute::canUseAsParamAttr(Kind)) { | } else if (Attribute::canUseAsParamAttr(Kind)) { | ||||
Assert((ArgCount) == 1, "this attribute should have one argument"); | Assert((ArgCount) == 1, "this attribute should have one argument"); | ||||
▲ Show 20 Lines • Show All 1,559 Lines • Show Last 20 Lines |
clang-format: please reformat the code