[flang-commits] [flang] [flang][rfc] Add represention of volatile references (PR #132486)
Asher Mancinelli via flang-commits
flang-commits at lists.llvm.org
Mon Mar 31 15:48:20 PDT 2025
================
@@ -510,6 +510,17 @@ mlir::Value fir::FirOpBuilder::convertWithSemantics(
return createConvert(loc, toTy, val);
}
+mlir::Value fir::FirOpBuilder::createConvertWithVolatileCast(mlir::Location loc,
+ mlir::Type toTy,
+ mlir::Value val) {
+ if (fir::isa_volatile_type(val.getType()) != fir::isa_volatile_type(toTy)) {
+ mlir::Type volatileAdjustedType = fir::updateTypeWithVolatility(
+ val.getType(), fir::isa_volatile_type(toTy));
+ val = create<fir::VolatileCastOp>(loc, volatileAdjustedType, val);
+ }
----------------
ashermancinelli wrote:
I added a folder for VolatileCast, so we should be able to add the cast no matter what and simplify this a bit.
https://github.com/llvm/llvm-project/pull/132486
More information about the flang-commits
mailing list