llvm-project/llvm/lib/Transforms/InstCombine
David Bolvansky dbcdad51ff [InstCombine] (1 << (C - x)) -> ((1 << C) >> x) if C is bitwidth - 1
Summary:
```
%a = sub i32 31, %x
%r = shl i32 1, %a
  =>
%d = shl i32 1, 31
%r = lshr i32 %d, %x

Done: 1
Optimization is correct!
```

https://rise4fun.com/Alive/btZm

Reviewers: spatel, lebedev.ri, nikic

Reviewed By: lebedev.ri

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D63652

llvm-svn: 364073
2019-06-21 16:25:32 +00:00
..
CMakeLists.txt [InstCombine] Optimize `atomicrmw <op>, 0` into `load atomic` when possible 2019-02-07 21:27:23 +00:00
InstCombineAddSub.cpp [InstCombine] Handle -(X-Y) --> (Y-X) for unary fneg when NSZ 2019-06-11 16:21:21 +00:00
InstCombineAndOrXor.cpp [InstCombine] try harder to form rotate (funnel shift) (PR20750) 2019-05-13 17:28:19 +00:00
InstCombineAtomicRMW.cpp [InstCombine] Extend saturating idempotent atomicrmw transform to FP 2019-03-01 19:50:36 +00:00
InstCombineCalls.cpp [InstCombine] cttz(abs(x)) -> cttz(x) 2019-06-21 15:26:22 +00:00
InstCombineCasts.cpp [InstCombine] Update fptrunc (fneg x)) -> (fneg (fptrunc x) for unary FNeg 2019-06-11 15:45:41 +00:00
InstCombineCompares.cpp [InstCombine] fix typo in comment; NFC 2019-06-20 20:23:32 +00:00
InstCombineInternal.h [InstCombine] Refactor OptimizeOverflowCheck; NFCI 2019-05-26 11:43:37 +00:00
InstCombineLoadStoreAlloca.cpp Use the DataLayout::typeSizeEqualsStoreSize helper. NFC 2019-05-24 09:20:20 +00:00
InstCombineMulDivRem.cpp [InstCombine] canonicalize fdiv after fmul if reassociation is allowed 2019-04-15 13:23:38 +00:00
InstCombinePHI.cpp [opaque pointer types] Pass value type to LoadInst creation. 2019-02-01 20:44:24 +00:00
InstCombineSelect.cpp [InstCombine] allow unordered preds when canonicalizing to fabs() 2019-06-10 15:39:00 +00:00
InstCombineShifts.cpp [InstCombine] (1 << (C - x)) -> ((1 << C) >> x) if C is bitwidth - 1 2019-06-21 16:25:32 +00:00
InstCombineSimplifyDemanded.cpp [IntrinsicEmitter] Extend argument overloading with forward references. 2019-06-13 08:19:33 +00:00
InstCombineTables.td InstCombine/AMDGPU: Add dimension-aware image intrinsics to SimplifyDemanded 2018-06-21 13:37:31 +00:00
InstCombineVectorOps.cpp [InstCombine] prevent crashing with invalid extractelement index 2019-05-26 14:03:50 +00:00
InstructionCombining.cpp [InstCombine] Factor out unreachable inst idiom creation [NFC] 2019-04-17 17:37:58 +00:00
LLVMBuild.txt Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00