DetermineLiveOperandBits is missing a case for div instructions. Before the patch, the pass assumed that the operand of div instructions uses all the available bits which can be an overestimate.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Please can you add udiv/sdiv exhaustive test coverage to llvm-project\llvm\unittests\IR\DemandedBitsTest.cpp
Would be possible to use the same logic used for add and sub or I need to create something new? Also do you think we should add ir tests as well or that wouldn't be necessary
You'll probably have to create a similar ForeachKnownBits system from scratch
Adding IR tests to test\Analysis\DemandedBits is always welcome - its pretty empty in there
I don't think this is how division works. It mixes bits up far more than add/sub/mul for which a bit in the input can only affect equal or lower ones in the output.
This is why I wanted to see an exhaustive test, its more subtle than the current attempt - but there's definitely a case for a suitable demanded bitmask of the lower bits based off the number of common known leading sign/zero bits of the arguments.
This review may be stuck/dead, consider abandoning if no longer relevant.
Removing myself as reviewer in attempt to clean dashboard.