Jump to conversation
Unresolved conversations (3)
@goldsteinn goldsteinn Oct 22, 2023
Think you are missing negative test for this (also for non-dominating).
Outdated
...forms/InstCombine/InstCombineAndOrXor.cpp
HaohaiWen
@goldsteinn goldsteinn Oct 22, 2023
Think you are missing a negative test for this.
...forms/InstCombine/InstCombineAndOrXor.cpp
HaohaiWen
@goldsteinn goldsteinn Oct 19, 2023
Do you actually need the shifted value to be `zext`? I.e if you have `(shl (zext i24 to i32), 8)` that is bitwise equivilent to `(shl i32, 8)`
...forms/InstCombine/InstCombineAndOrXor.cpp
dtcxzyw goldsteinn
HaohaiWen
Resolved conversations (7)
@goldsteinn goldsteinn Oct 19, 2023
Can you also add an `i8`/`i8` test? Can you also add some todo/negative tests? Missing `zext` on low/high. shift amount not matching.
llvm/test/Transforms/InstCombine/funnel.ll
HaohaiWen
@goldsteinn goldsteinn Oct 19, 2023
Edit: NVM realized im mistaken.
Outdated
...forms/InstCombine/InstCombineAndOrXor.cpp
@goldsteinn goldsteinn Oct 12, 2023
The `and`/`zext`/`sub` pattern matching is ingeneral off. All you need is `Amt` and `A - Amt` where `A & (Width - 1) == 0`. Any `and`/`zext` on either `Amt` or `A-Amt` can be ignored (just peek through and/zext): https://alive2.llvm.org/ce/z/QSjy6K
Outdated
...forms/InstCombine/InstCombineAndOrXor.cpp
HaohaiWen
@goldsteinn goldsteinn Oct 12, 2023
Maybe just `computeKnownBits(L).ult(Width)`? This will cover `and` along with other cases.
Outdated
...forms/InstCombine/InstCombineAndOrXor.cpp
HaohaiWen
@goldsteinn goldsteinn Oct 12, 2023
You can do better than `m_Neg`. You can match and `C - V` where `C & (Width - 1) == 0`.
Outdated
...forms/InstCombine/InstCombineAndOrXor.cpp
HaohaiWen
@goldsteinn goldsteinn Oct 12, 2023
1) I'm not sure you need the 1-use check here. 2) If `KnownL` is zero, it will be poison shift. Think check should be `(KownL.getMaxValue() - 1).ult(Width)`
Outdated
...forms/InstCombine/InstCombineAndOrXor.cpp
HaohaiWen goldsteinn
@goldsteinn goldsteinn Oct 9, 2023
As a general rule, we don't do combines that require looking for partner instructions via use-list iteration. This is really the type of fold that makes more sense in a DAG context. If this where a high-ticket fold it might be different, but generally I'm opposed to this type of transform in InstCombine.
...forms/InstCombine/InstCombineAndOrXor.cpp
HaohaiWen