[llvm] ConstantFolding: Do not fold fcmp of denormal without known mode (PR #115407)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 8 01:26:32 PST 2024
================
@@ -1266,14 +1266,16 @@ Constant *llvm::ConstantFoldCompareInstOperands(
return ConstantFoldCompareInstOperands(Predicate, Ops1, Ops0, DL, TLI);
}
- // Flush any denormal constant float input according to denormal handling
- // mode.
- Ops0 = FlushFPConstant(Ops0, I, /* IsOutput */ false);
- if (!Ops0)
- return nullptr;
- Ops1 = FlushFPConstant(Ops1, I, /* IsOutput */ false);
- if (!Ops1)
- return nullptr;
+ if (CmpInst::isFPPredicate(Predicate)) {
+ // Flush any denormal constant float input according to denormal handling
+ // mode.
+ Ops0 = FlushFPConstant(Ops0, I, /* IsOutput=*/false);
+ if (!Ops0)
+ return nullptr;
+ Ops1 = FlushFPConstant(Ops1, I, /* IsOutput= */ false);
----------------
nikic wrote:
```suggestion
Ops1 = FlushFPConstant(Ops1, I, /* IsOutput=*/false);
```
https://github.com/llvm/llvm-project/pull/115407
More information about the llvm-commits
mailing list