Fixes PR#52190. There is already a check for converting ashr instructions with non-negative left-hand sides into lshr; this patch adds an optimization to remove ashr altogether if the left-hand side is known to be in the range [-1, 1).
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
LGTM with required changes made.
llvm/test/Transforms/CorrelatedValuePropagation/ashr.ll | ||
---|---|---|
121 | Please add a couple of tests for edge cases. (e.g. ashr -2, X, ashr 1, X) |
Comment Actions
Thanks for the review @reames! I've added another test to cover the edge cases. Can you commit this for me?
Comment Actions
Sure. To confirm, this is code you intend to contribute to llvm under the terms of the relevant licenses and agreements, and have the authority to agree to same?
Comment Actions
Yes. For commit attribution, you can use the same name and email as in commit 738e7f1231949ec248c1d8d154783338215613d1. Thanks!
Please add a couple of tests for edge cases. (e.g. ashr -2, X, ashr 1, X)