Skip to content

Commit cbd541d

Browse files
authored
Remove UnsafeFPMath for LLVM 21+ (#8851)
1 parent acb5850 commit cbd541d

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

src/CodeGen_Internal.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,9 @@ void get_target_options(const llvm::Module &module, llvm::TargetOptions &options
612612

613613
options = llvm::TargetOptions();
614614
options.AllowFPOpFusion = per_instruction_fast_math_flags ? llvm::FPOpFusion::Strict : llvm::FPOpFusion::Fast;
615+
#if LLVM_VERSION < 210
615616
options.UnsafeFPMath = !per_instruction_fast_math_flags;
617+
#endif
616618
options.NoInfsFPMath = !per_instruction_fast_math_flags;
617619
options.NoNaNsFPMath = !per_instruction_fast_math_flags;
618620
options.HonorSignDependentRoundingFPMathOption = !per_instruction_fast_math_flags;

src/CodeGen_PTX_Dev.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,9 @@ vector<char> CodeGen_PTX_Dev::compile_to_src() {
614614

615615
TargetOptions options;
616616
options.AllowFPOpFusion = FPOpFusion::Fast;
617+
#if LLVM_VERSION < 210
617618
options.UnsafeFPMath = true;
619+
#endif
618620
options.NoInfsFPMath = true;
619621
options.NoNaNsFPMath = true;
620622
options.HonorSignDependentRoundingFPMathOption = false;

0 commit comments

Comments
 (0)