Skip to content

Small fixes to soa.h and fixed_point.h - #442

Merged
mysterymath merged 3 commits into
llvm-mos:mainfrom
jroweboy:smallfixes
Jul 13, 2026
Merged

mysterymath merged 3 commits into
llvm-mos:mainfrom
jroweboy:smallfixes

Conversation

@jroweboy

@jroweboy jroweboy commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

See each commit for a description of the changes made. I did not add any new llvm-lit tests for the soa.h changes, but I did write some in case we want to add that. llvm-mos/llvm-test-suite#19 For the fixed_point.h changes, I added some new division tests here.

This fixes a few issues I've ran into over the years that I've patched locally and decided to finally stop being lazy and upstream them.

Some extra notes

  • Defaulting the fixed point constructors is legal since the class from what i can tell because itsjust a raw _BitInt under the covers. This change lets it be used as a field in soa.h structs.
  • Fixed point divisions been broken and we never tested for it.
  • soa.h 's use of pragma_unroll causes the line information for the writes to get muddled in the debug symbol output, making it hard to follow. Whenever i would write array[1] = 0x10; for instance, that would have no line information afaict (i could also just be bad at understanding dwarf, but this change kept the same optimized output, while retaining source info in my testing)

jroweboy added 3 commits July 6, 2026 16:07
Changes from pragma unrolled loops into recursive tail call functions
in order to make the debugging info created for these lines simpler.
With pragma unroll, I noticed that the debug info could not resolve
the soa inlined accessors properly because the unrolling destroyed
the line information during an optimization pass. This new approach
performs identically (as LLVM properly unrolls the recursion) and
retains the debug information in my testing.
This allows users to use the FixedPoint class in classes that require
trivial types such as Soa structs. This is safe because the previous
constructors only did a byte for byte copy anyway (the default behavior)
This was silently broken before due to the infrequent use of division on the platform
@mysterymath
mysterymath merged commit b514405 into llvm-mos:main Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants