In order to not generate an unnecessary G_CTLZ, I extended the constant folder
in the CSEMIRBuilder to handle G_CTLZ. I also added some extra handing of
vector constants too. It seems we don't have any support for doing constant
folding of vector constants, so the tests show some other useless G_SUB
instructions too.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
G_UMULH x, (1 << c)) -> x >> (bitwidth - c)
This doesn't work when c is 0 because you get an out of range shift. In general you need something like x >> 1 >> (bitwidth - 1 - c).
Comment Actions
Oops sorry about that, I didn't realize this was already on my branch when I committed 72ce310bf0de so this went in by mistake.
Since it's already gone through a round of review I'll leave it in and update with post-review comments or revert if requested.
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp | ||
---|---|---|
4598 | Thanks. I've fixed this by using matchUnaryPredicate() instead in 17b89f9daad56f80c29b46bed0b6ce94093dcfc9 |
This will no longer handle the "mix of non-NPQ/NPQ paths" that D110890 can generate.