[PATCH] D26000: [InstCombine] Folding of shifts by the sum of positive values

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 26 10:59:55 PDT 2016


RKSimon created this revision.
RKSimon added reviewers: majnemer, nadav, spatel, filcab, andreadb.
RKSimon added subscribers: llvm-commits, nadav.
RKSimon set the repository for this revision to rL LLVM.

This patch introduces the combine:

(C1 shift (A add C2)) -> ((C1 shift C2) shift A)
iff A and C2 are both positive

If both A and C2 are know to be positive then we can safely split into 2 shifts, permitting the folding of the Inner shift.

Fix for the spec benchmark case mentioned by @nadav on PR15141 (assuming we can prove that the inputs as positive).


Repository:
  rL LLVM

https://reviews.llvm.org/D26000

Files:
  lib/Transforms/InstCombine/InstCombineShifts.cpp
  test/Transforms/InstCombine/shift-add.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26000.75917.patch
Type: text/x-patch
Size: 4079 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161026/093001ef/attachment.bin>


More information about the llvm-commits mailing list