Skip to content

[Conversion] Migrate away from PointerUnion::{is,get} (NFC) #122421

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mlir/lib/Conversion/MemRefToSPIRV/MemRefToSPIRV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,7 @@ LogicalResult ReinterpretCastPattern::matchAndRewrite(
if (auto val = dyn_cast<Value>(offset))
return val;

int64_t attrVal = cast<IntegerAttr>(offset.get<Attribute>()).getInt();
int64_t attrVal = cast<IntegerAttr>(cast<Attribute>(offset)).getInt();
Attribute attr = rewriter.getIntegerAttr(intType, attrVal);
return rewriter.createOrFold<spirv::ConstantOp>(loc, intType, attr);
}();
Expand Down
23 changes: 11 additions & 12 deletions mlir/lib/Conversion/MeshToMPI/MeshToMPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,13 +240,12 @@ struct ConvertUpdateHaloOp
auto loc = op.getLoc();

// convert a OpFoldResult into a Value
auto toValue = [&rewriter, &loc](OpFoldResult &v) {
return v.is<Value>()
? v.get<Value>()
: rewriter.create<::mlir::arith::ConstantOp>(
loc,
rewriter.getIndexAttr(
cast<IntegerAttr>(v.get<Attribute>()).getInt()));
auto toValue = [&rewriter, &loc](OpFoldResult &v) -> Value {
if (auto value = dyn_cast<Value>(v))
return value;
return rewriter.create<::mlir::arith::ConstantOp>(
loc, rewriter.getIndexAttr(
cast<IntegerAttr>(cast<Attribute>(v)).getInt()));
};

auto dest = op.getDestination();
Expand All @@ -267,11 +266,11 @@ struct ConvertUpdateHaloOp
getMixedValues(op.getStaticHaloSizes(), op.getHaloSizes(), rewriter);
// subviews need Index values
for (auto &sz : haloSizes) {
if (sz.is<Value>()) {
sz = rewriter
.create<arith::IndexCastOp>(loc, rewriter.getIndexType(),
sz.get<Value>())
.getResult();
if (auto value = dyn_cast<Value>(sz)) {
sz =
rewriter
.create<arith::IndexCastOp>(loc, rewriter.getIndexType(), value)
.getResult();
}
}

Expand Down
2 changes: 1 addition & 1 deletion mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ static Value getAsLLVMValue(OpBuilder &builder, Location loc,
return builder.create<LLVM::ConstantOp>(loc, intAttr).getResult();
}

return foldResult.get<Value>();
return cast<Value>(foldResult);
}

namespace {
Expand Down
Loading