llvm-pretty icon indicating copy to clipboard operation
llvm-pretty copied to clipboard

change pretty-printing of floats because of LLVM IR restrictions

Open Ptival opened this issue 1 year ago • 2 comments

As was pointed out by @tomsmeding here: https://github.com/GaloisInc/llvm-pretty/issues/135#issuecomment-2227477305 we cannot use 32-bit (8 characters) "float" constants in LLVM IR.

Instead, we must embed the 32-bit float as 64-bit double constants with the same meaning.

Ptival avatar Jul 15 '24 03:07 Ptival

The particular case that triggered the problem for me is fixed with this PR, thanks! But this is only really a spot test, because this only accidentally popped up in the test suite of a larger codebase.

Thanks for the very quick PR!

tomsmeding avatar Jul 15 '24 10:07 tomsmeding

In a discussion with the group, we feel like we may just want to always print the hexadecimal version, possibly providing a flag to add a best-effort decimal expansion as a comment nearby where applicable. Setting this as a draft until I have more time to handle these considerations.

Ptival avatar Jul 15 '24 18:07 Ptival