[llvm] [ConstantFolding] Constant fold nextafter and nexttoward (PR #168794)

Sayan Sivakumaran via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 24 19:48:51 PST 2025


================
@@ -0,0 +1,256 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
+; RUN: cat %S/floating-point-constants.ll %s | opt -passes=instcombine -S | FileCheck %s
----------------
sivakusayan wrote:

I did it that way so I didn't have to copy-paste floating point constants everywhere, and could instead pull in the values from the `floating-point-constants.ll` file. I couldn't really find an established pattern for it, so I [asked for suggestions in the LLVM Discord](https://discordapp.com/channels/636084430946959380/642374147640524831/1435986208596426893). Do you know of a better way to do this? 

If it feels too strange, I could copy what other lit tests do. I see other lit tests [ilogb folding](https://github.com/llvm/llvm-project/blob/c6f433e880a01a29325f4d7d2b98c84feecf2297/llvm/test/Transforms/InstCombine/ilogb.ll#L76) hardcode the constants for example.

https://github.com/llvm/llvm-project/pull/168794


More information about the llvm-commits mailing list