hanchenye-llvm-project/llvm/lib/Transforms/InstCombine
Charlie Turner 6153698f26 [InstCombinePHI] Partial simplification of identity operations.
Consider this code:

BB:
  %i = phi i32 [ 0, %if.then ], [ %c, %if.else ]
  %add = add nsw i32 %i, %b
  ...

In this common case the add can be moved to the %if.else basic block, because
adding zero is an identity operation. If we go though %if.then branch it's
always a win, because add is not executed; if not, the number of instructions
stays the same.

This pattern applies also to other instructions like sub, shl, shr, ashr | 0,
mul, sdiv, div | 1.

Patch by Jakub Kuderski!

llvm-svn: 244887
2015-08-13 12:38:58 +00:00
..
CMakeLists.txt
InstCombineAddSub.cpp [InstCombine] Generalize sub of selects optimization to all BinaryOperators 2015-07-14 22:39:23 +00:00
InstCombineAndOrXor.cpp [ConstantRange] Split makeICmpRegion in two. 2015-03-18 00:41:24 +00:00
InstCombineCalls.cpp [InstCombine] SSE/AVX vector shifts demanded shift amount bits 2015-08-13 07:39:03 +00:00
InstCombineCasts.cpp Add support for floating-point minnum and maxnum 2015-08-11 09:12:57 +00:00
InstCombineCompares.cpp Fix PR24354. 2015-08-11 21:33:55 +00:00
InstCombineInternal.h [InstCombine] Employ AliasAnalysis in FindAvailableLoadedValue 2015-07-10 06:55:49 +00:00
InstCombineLoadStoreAlloca.cpp [InstCombine] Actually combine AA metadata when replacing one load with another 2015-07-10 22:30:17 +00:00
InstCombineMulDivRem.cpp Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC) 2015-06-23 09:49:53 +00:00
InstCombinePHI.cpp [InstCombinePHI] Partial simplification of identity operations. 2015-08-13 12:38:58 +00:00
InstCombineSelect.cpp Add support for floating-point minnum and maxnum 2015-08-11 09:12:57 +00:00
InstCombineShifts.cpp Convert PHI getIncomingValue() to foreach over incoming_values(). NFC. 2015-05-12 20:05:31 +00:00
InstCombineSimplifyDemanded.cpp Add support for floating-point minnum and maxnum 2015-08-11 09:12:57 +00:00
InstCombineVectorOps.cpp [InstSimplify] Teach InstSimplify how to simplify extractelement 2015-07-13 01:15:53 +00:00
InstructionCombining.cpp Fix some comment typos. 2015-08-08 18:27:36 +00:00
LLVMBuild.txt
Makefile