[llvm] [C API] Add getters and setters for fast-math flags on relevant instructions (PR #75123)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 12 01:00:18 PST 2023
================
@@ -770,8 +770,19 @@ struct FunCloner {
}
LLVMAddIncoming(Dst, Values.data(), Blocks.data(), IncomingCount);
+ if (LLVMGetCanUseFastMathFlags(Src))
+ LLVMSetFastMathFlags(Dst, LLVMGetFastMathFlags(Src));
return Dst;
}
+ case LLVMSelect: {
+ LLVMValueRef If = CloneValue(LLVMGetOperand(Src, 0));
+ LLVMValueRef Then = CloneValue(LLVMGetOperand(Src, 1));
+ LLVMValueRef Else = CloneValue(LLVMGetOperand(Src, 2));
+ Dst = LLVMBuildSelect(Builder, If, Then, Else, Name);
+ if (LLVMGetCanUseFastMathFlags(Src))
+ LLVMSetFastMathFlags(Dst, LLVMGetFastMathFlags(Src));
----------------
nikic wrote:
Rather than adding this to specific cases (and having to list out all the FP instructions), can we do this once after the switch?
https://github.com/llvm/llvm-project/pull/75123
More information about the llvm-commits
mailing list