[clang] [CIR][NFC] Upstream support for FP environments and RAII options (PR #179121)
Ayokunle Amodu via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 13 09:42:59 PST 2026
================
@@ -1119,6 +1136,59 @@ void CIRGenFunction::emitNullInitialization(mlir::Location loc, Address destPtr,
builder.createStore(loc, zeroValue, destPtr);
}
+CIRGenFunction::CIRGenFPOptionsRAII::CIRGenFPOptionsRAII(CIRGenFunction &cgf,
+ const clang::Expr *e)
+ : cgf(cgf) {
+ ConstructorHelper(e->getFPFeaturesInEffect(cgf.getLangOpts()));
+}
+
+CIRGenFunction::CIRGenFPOptionsRAII::CIRGenFPOptionsRAII(CIRGenFunction &cgf,
+ FPOptions fpFeatures)
+ : cgf(cgf) {
+ ConstructorHelper(fpFeatures);
+}
+
+void CIRGenFunction::CIRGenFPOptionsRAII::ConstructorHelper(
+ FPOptions fpFeatures) {
+ oldFPFeatures = cgf.curFPFeatures;
+ cgf.curFPFeatures = fpFeatures;
+
+ oldExcept = cgf.builder.getDefaultConstrainedExcept();
+ oldRounding = cgf.builder.getDefaultConstrainedRounding();
+
+ if (oldFPFeatures == fpFeatures)
----------------
ayokunle321 wrote:
I believe the other options are still to be saved, i.e. `oldExcept`, `oldRounding` regardless of the condition. @andykaylor could you please clarify
https://github.com/llvm/llvm-project/pull/179121
More information about the cfe-commits
mailing list