Issue 136498
Summary [LSR] Regression in array access with constant stride
Labels new issue
Assignees
Reporter abdimoallim
    It appears LSR does not recognize that shift operations could be promoted to operate directly on 64-bit values instead of adding extra 32-bit truncation and sign-extension for ops on loop induction variables. E.g. direct 64-bit shifting compared to `lea r9d, [8*rcx]` then `movsxd r9, r9d` for `i*8` and `i<<3` respectively.

```llvm
%35 = trunc nuw nsw i64 %indvars.iv to i32
%shl = shl i32 %35, 3
%idxprom = sext i32 %shl to i64
%arrayidx = getelementptr inbounds i32, ptr %src, i64 %idxprom
```

[Godbolt test](https://godbolt.org/z/xe6d9Ks69) (timeout on Alive2).
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to