If a target can only emit 8-bits data, it will loop in EmitValueImpl since it will try to split a 32-bits data in 1 chunk of 32-bits.
Since we know that "Size" is not supported on the target, we limit the value of "EmissionSize" to the greatest power of 2, smaller than "Size".
Details
Details
- Reviewers
majnemer • rafael llvm-commits
Diff Detail
Diff Detail
Event Timeline
Comment Actions
Can this be tested?
EmissionSize can now go out of the loop.
The comment just before the code you changed needs to be updated.
Comment Actions
I've updated the comment just above the changes.
Also, I've computed the EmissionSize based on the min of (Size - 1) and Remaining.
This is closer to the original implementation.
If Size is a number that is not a power of 2 (e.g. 7), this should result in a 4+2+1 split in normal cases.
If the target does not support 4, instead of looping we will split as 2+2+2+1; the 2 values may be split as 1+1 if required.
Unfortunately, this can't be tested since I don't think there is a target in the official repository that can't emit 4 bytes.