[X86] Loop-invariant operand defeats vector lowering of i256/i512 CTPOP and logic ops
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Noticed with `_BitInt(512)` in a Hamming-distance loop. #163788 fixed the case where both operands are loaded; the scalar chain comes back when one of them is loop-invariant.
https://godbolt.org/z/G9jdnr8eb
```c
typedef unsigned _BitInt(512) u512;
void inv(const u512 *db, u512 q, int n, int *o) { for (int i=0;i
Contributor guide
Research direction
Start at X86::mayFoldIntoVector and inspect how CTPOP and logic operands are admitted, then reproduce the inv, constant-mask, sparse-mask, and volatile cases with the provided IR or llc runs. Add coverage under llvm/test/CodeGen/X86, including the generated invariant, GPR-resident, and volatile cases. Done means the invariant loop vectorizes without regressing the three scalar cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- compilers, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100