[all-commits] [llvm/llvm-project] 6538b3: [NFC][InstCombine] Tests for "X - (X / C) * C == 0...
Egor Bogatov via All-commits
all-commits at lists.llvm.org
Fri Jun 12 00:20:42 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 6538b3adbeee1c4cf2550014882fb36d3c8bf66d
https://github.com/llvm/llvm-project/commit/6538b3adbeee1c4cf2550014882fb36d3c8bf66d
Author: EgorBo <egorbo at gmail.com>
Date: 2020-06-12 (Fri, 12 Jun 2020)
Changed paths:
A llvm/test/Transforms/InstCombine/add-shl-sdiv-to-srem.ll
Log Message:
-----------
[NFC][InstCombine] Tests for "X - (X / C) * C == 0" pattern
See https://reviews.llvm.org/D79369
Commit: 012909dcaf852d4260decd04a76dfe45e7d329c0
https://github.com/llvm/llvm-project/commit/012909dcaf852d4260decd04a76dfe45e7d329c0
Author: EgorBo <egorbo at gmail.com>
Date: 2020-06-12 (Fri, 12 Jun 2020)
Changed paths:
M llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
M llvm/test/Transforms/InstCombine/add-shl-sdiv-to-srem.ll
Log Message:
-----------
[InstCombine] "X - (X / C) * C == 0" to "X & C-1 == 0"
Summary:
"X % C == 0" is optimized to "X & C-1 == 0" (where C is a power-of-two)
However, "X % Y" can also be represented as "X - (X / Y) * Y" so if I rewrite the initial expression:
"X - (X / C) * C == 0" it's not currently optimized to "X & C-1 == 0", see godbolt: https://godbolt.org/z/KzuXUj
This is my first contribution to LLVM so I hope I didn't mess things up
Reviewers: lebedev.ri, spatel
Reviewed By: lebedev.ri
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D79369
Compare: https://github.com/llvm/llvm-project/compare/425c6f079b9c...012909dcaf85
More information about the All-commits
mailing list