diff options
author | David Green <david.green@arm.com> | 2019-12-19 10:41:13 +0000 |
---|---|---|
committer | David Green <david.green@arm.com> | 2019-12-19 12:36:46 +0000 |
commit | a59cc5e128f09ec5048c142cafaadea279406eba (patch) | |
tree | 28ad3aa31e996c4ac21fa9a9da51963a13214d39 /llvm/lib/DebugInfo/DWARF/DWARFOptimizer.cpp | |
parent | d38153325f3d23b81be9c9916afc3a45270094aa (diff) | |
download | bcm5719-llvm-a59cc5e128f09ec5048c142cafaadea279406eba.tar.gz bcm5719-llvm-a59cc5e128f09ec5048c142cafaadea279406eba.zip |
[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
Diffstat (limited to 'llvm/lib/DebugInfo/DWARF/DWARFOptimizer.cpp')
0 files changed, 0 insertions, 0 deletions