[all-commits] [llvm/llvm-project] 3bb794: [CIR] Keep fast-math flags on the CIR builder and ...

David Rivera via All-commits all-commits at lists.llvm.org
Fri Sep 25 13:48:06 PDT 2026


  Branch: refs/heads/users/riverdave/ffastmath-flags
  Home:   https://github.com/llvm/llvm-project
  Commit: 3bb794c0888e49a4d7722d9d653a5d80304067df
      https://github.com/llvm/llvm-project/commit/3bb794c0888e49a4d7722d9d653a5d80304067df
  Author: David Rivera <davidriverg at gmail.com>
  Date:   2026-09-25 (Fri, 25 Sep 2026)

  Changed paths:
    M clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h
    M clang/include/clang/CIR/Dialect/IR/CIRAttrs.td
    M clang/include/clang/CIR/Dialect/IR/CIRDialect.h
    M clang/include/clang/CIR/Dialect/IR/CIROps.td
    M clang/include/clang/CIR/MissingFeatures.h
    M clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp
    M clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp
    M clang/lib/CIR/CodeGen/CIRGenFunction.cpp
    M clang/lib/CIR/CodeGen/CIRGenFunction.h
    M clang/lib/CIR/Dialect/IR/CIRDialect.cpp
    M clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
    M clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.h
    R clang/test/CIR/CodeGen/fp-contract-fast.c
    M clang/test/CIR/CodeGen/fp-contract.c
    M clang/test/CIR/CodeGen/fp-math-precision-opts.c
    M clang/test/CIR/CodeGenCUDA/fp-contract.cu
    R clang/test/CIR/Lowering/fastmath-contract.cir
    M clang/test/CIR/Lowering/fenv.cir
    M clang/utils/TableGen/CIRLoweringEmitter.cpp

  Log Message:
  -----------
  [CIR] Keep fast-math flags on the CIR builder and address review

Drop the process-wide OpBuilder registry. CIRBaseBuilderTy now holds the
fast-math flags next to the constrained-FP state, the same way IRBuilder
does in classic CodeGen:

- CIRGenFunction::setFastMathFlags derives the flags from FPOptions (only
  `contract` for now) and is called from the constructor and from
  CIRGenFPOptionsRAII, which restores them like classic CodeGen's FMFGuard.
  ConstrainedFPRAII restores them for nested CIRGenFunctions.
- createFAdd/FSub/FMul/FDiv/FRem go through one createFPBinOp helper that
  attaches both fenv and fastmath_flags.
- Scope is limited to the FP binary ops. fneg, cmp/vec.cmp and the FP
  builtins are left for follow-ups.
- The generated lowering passes op.getFastmathFlagsAttr() instead of
  looking the attribute up by name.

Tests cover -ffp-contract=fast-honor-pragmas, nested pragmas with state
restored after each scope, strict FP combined with contract, and a vector
op.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list