forked from OSchip/llvm-project
Using getContext() instead of getInstruction()->getContext() on Operation (NFC)
PiperOrigin-RevId: 240088209
This commit is contained in:
parent
63e8725bc2
commit
bb621a5596
|
@ -94,7 +94,7 @@ public:
|
|||
state->setAttr(name, value);
|
||||
}
|
||||
void setAttr(StringRef name, Attribute value) {
|
||||
setAttr(Identifier::get(name, getInstruction()->getContext()), value);
|
||||
setAttr(Identifier::get(name, getContext()), value);
|
||||
}
|
||||
|
||||
/// Return true if there are no users of any results of this operation.
|
||||
|
|
|
@ -1063,7 +1063,7 @@ Block *AffineForOp::createBody() {
|
|||
// Create a new block for the body, and add an argument for the induction
|
||||
// variable.
|
||||
Block *body = new Block();
|
||||
body->addArgument(IndexType::get(getInstruction()->getContext()));
|
||||
body->addArgument(IndexType::get(getContext()));
|
||||
bodyRegion.push_back(body);
|
||||
return body;
|
||||
}
|
||||
|
@ -1139,13 +1139,11 @@ int64_t AffineForOp::getConstantUpperBound() {
|
|||
}
|
||||
|
||||
void AffineForOp::setConstantLowerBound(int64_t value) {
|
||||
setLowerBound(
|
||||
{}, AffineMap::getConstantMap(value, getInstruction()->getContext()));
|
||||
setLowerBound({}, AffineMap::getConstantMap(value, getContext()));
|
||||
}
|
||||
|
||||
void AffineForOp::setConstantUpperBound(int64_t value) {
|
||||
setUpperBound(
|
||||
{}, AffineMap::getConstantMap(value, getInstruction()->getContext()));
|
||||
setUpperBound({}, AffineMap::getConstantMap(value, getContext()));
|
||||
}
|
||||
|
||||
AffineForOp::operand_range AffineForOp::getLowerBoundOperands() {
|
||||
|
|
|
@ -244,7 +244,7 @@ static bool isContiguousAccess(Value &iv, LoadOrStoreOp memoryOp,
|
|||
auto layoutMap = memRefType.getAffineMaps();
|
||||
// TODO(ntv): remove dependence on Builder once we support non-identity
|
||||
// layout map.
|
||||
Builder b(memoryOp->getInstruction()->getContext());
|
||||
Builder b(memoryOp.getContext());
|
||||
if (layoutMap.size() >= 2 ||
|
||||
(layoutMap.size() == 1 &&
|
||||
!(layoutMap[0] ==
|
||||
|
|
|
@ -720,7 +720,7 @@ void CmpIOp::print(OpAsmPrinter *p) {
|
|||
assert(predicateValue >= static_cast<int>(CmpIPredicate::FirstValidValue) &&
|
||||
predicateValue < static_cast<int>(CmpIPredicate::NumPredicates) &&
|
||||
"unknown predicate index");
|
||||
Builder b(getInstruction()->getContext());
|
||||
Builder b(getContext());
|
||||
auto predicateStringAttr =
|
||||
b.getStringAttr(getPredicateNames()[predicateValue]);
|
||||
p->printAttribute(predicateStringAttr);
|
||||
|
|
|
@ -454,7 +454,7 @@ static AffineMap projectedPermutationMap(VectorTransferOpTy transfer,
|
|||
"Shape and ratio not of the same size");
|
||||
unsigned dim = 0;
|
||||
SmallVector<AffineExpr, 4> keep;
|
||||
MLIRContext *context = transfer->getInstruction()->getContext();
|
||||
MLIRContext *context = transfer.getContext();
|
||||
functional::zipApply(
|
||||
[&dim, &keep, context](int64_t shape, int64_t ratio) {
|
||||
assert(shape >= ratio && "shape dim must be greater than ratio dim");
|
||||
|
|
|
@ -456,14 +456,12 @@ void OpEmitter::genAttrGetters() {
|
|||
// Returns the default value if not set.
|
||||
// TODO: this is inefficient, we are recreating the attribute for every
|
||||
// call. This should be set instead.
|
||||
method.body()
|
||||
<< " if (!attr)\n"
|
||||
" return "
|
||||
<< formatv(
|
||||
attr.getConvertFromStorageCall(),
|
||||
formatv(attr.getDefaultValueTemplate(),
|
||||
"mlir::Builder(this->getInstruction()->getContext())"))
|
||||
<< ";\n";
|
||||
method.body() << " if (!attr)\n"
|
||||
" return "
|
||||
<< formatv(attr.getConvertFromStorageCall(),
|
||||
formatv(attr.getDefaultValueTemplate(),
|
||||
"mlir::Builder(this->getContext())"))
|
||||
<< ";\n";
|
||||
}
|
||||
method.body() << " return "
|
||||
<< formatv(attr.getConvertFromStorageCall(), "attr") << ";\n";
|
||||
|
|
Loading…
Reference in New Issue