[all-commits] [llvm/llvm-project] d38153: [Instcombine] Add select canonicalization tests. NFC
David Green via All-commits
all-commits at lists.llvm.org
Thu Dec 19 04:38:13 PST 2019
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: d38153325f3d23b81be9c9916afc3a45270094aa
https://github.com/llvm/llvm-project/commit/d38153325f3d23b81be9c9916afc3a45270094aa
Author: David Green <david.green at arm.com>
Date: 2019-12-19 (Thu, 19 Dec 2019)
Changed paths:
A llvm/test/Transforms/InstCombine/select-imm-canon.ll
Log Message:
-----------
[Instcombine] Add select canonicalization tests. NFC
Commit: a59cc5e128f09ec5048c142cafaadea279406eba
https://github.com/llvm/llvm-project/commit/a59cc5e128f09ec5048c142cafaadea279406eba
Author: David Green <david.green at arm.com>
Date: 2019-12-19 (Thu, 19 Dec 2019)
Changed paths:
M llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
M llvm/test/Transforms/InstCombine/select-imm-canon.ll
Log Message:
-----------
[InstCombine] Canonicalize select immediates
In certain situations after inlining and simplification we end up with
code that is _almost_ a min/max pattern, but contains constants that
have been demand-bit optimised to the wrong values, ending up with code
like:
%1 = icmp slt i32 %shr, -128
%2 = select i1 %1, i32 128, i32 %shr
%.inv = icmp sgt i32 %shr, 127
%spec.select.i = select i1 %.inv, i32 127, i32 %2
%conv7 = trunc i32 %spec.select.i to i8
This should be turned into a min/max pattern, but the -128 in the first
select was instead transformed into 128, as only the bottom byte was
ever demanded.
To fix this, I've put in further canonicalisation for the immediates of
selects, preferring to use the same value as the icmp if available.
Differential Revision: https://reviews.llvm.org/D71516
Compare: https://github.com/llvm/llvm-project/compare/dde7b6bcda9d...a59cc5e128f0
More information about the All-commits
mailing list