1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00
llvm-mirror/lib/Transforms/InstCombine
David Green 7ec4b0ea72 [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
2019-12-19 12:36:46 +00:00
..
CMakeLists.txt
InstCombineAddSub.cpp [InstCombine] Invert add A, sext(B) --> sub A, zext(B) canonicalization (to sub A, zext B -> add A, sext B) 2019-12-05 21:21:30 +03:00
InstCombineAndOrXor.cpp
InstCombineAtomicRMW.cpp
InstCombineCalls.cpp [IR] Split out target specific intrinsic enums into separate headers 2019-12-11 18:02:14 -08:00
InstCombineCasts.cpp [InstCombine] Insert instructions before adding them to worklist 2019-12-18 14:55:41 -05:00
InstCombineCompares.cpp Reland [DataLayout] Fix occurrences that size and range of pointers are assumed to be the same. 2019-12-13 14:30:21 +00:00
InstCombineInternal.h
InstCombineLoadStoreAlloca.cpp [InstCombine] Teach removeBitcastsFromLoadStoreOnMinMax not to change the size of a store. 2019-12-16 12:12:54 -08:00
InstCombineMulDivRem.cpp [InstCombine] fix undef propagation for vector urem transform (PR44186) 2019-12-02 12:17:38 -05:00
InstCombinePHI.cpp
InstCombineSelect.cpp [InstCombine] Expand usub_sat patterns to handle constants 2019-11-30 16:58:01 +00:00
InstCombineShifts.cpp
InstCombineSimplifyDemanded.cpp [InstCombine] Canonicalize select immediates 2019-12-19 12:36:46 +00:00
InstCombineTables.td
InstCombineVectorOps.cpp [InstCombine] replace shuffle's insertelement operand if inserted scalar is not demanded 2019-12-10 10:10:05 -05:00
InstructionCombining.cpp [InstCombine] Insert instructions before adding them to worklist 2019-12-18 14:55:41 -05:00
LLVMBuild.txt