[all-commits] [llvm/llvm-project] 2e8733: [InstCombine] convert mul by negative-pow2 to nega...
Sanjay Patel via All-commits
all-commits at lists.llvm.org
Sun Oct 2 10:17:03 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 2e87333bfe7e226533fb66c84015c4523e352d3f
https://github.com/llvm/llvm-project/commit/2e87333bfe7e226533fb66c84015c4523e352d3f
Author: Sanjay Patel <spatel at rotateright.com>
Date: 2022-10-02 (Sun, 02 Oct 2022)
Changed paths:
M llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
M llvm/test/Transforms/InstCombine/add.ll
M llvm/test/Transforms/InstCombine/mul.ll
Log Message:
-----------
[InstCombine] convert mul by negative-pow2 to negate and shift
This is an unusual canonicalization because we create an extra instruction,
but it's likely better for analysis and codegen (similar reasoning as D133399).
InstCombine::Negator may create this kind of multiply from negate and shift,
but this should not conflict because of the narrow negation.
I don't know how to create a fully general proof for this kind of transform in
Alive2, but here's an example with bitwidths similar to one of the regression
tests:
https://alive2.llvm.org/ce/z/J3jTjR
Differential Revision: https://reviews.llvm.org/D133667
More information about the All-commits
mailing list