[PATCH] D46380: [InstCombine] Extending InstructionSimplify to check OverflowingBinaryOperators and PossiblyExactOperators safety

Omer Paparo Bivas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 2 23:44:16 PDT 2018


opaparo created this revision.
opaparo added reviewers: spatel, craig.topper, AndreiGrischenko, zvi, sanjoy.

As of today, InstCombine does not transform patterns that include a OverflowingBinaryOperator or a PossiblyExactOperator, as a transformation may result in a different behavior in the case that that operand loses bits. However, in many cases these operators can be proven to not violate their restrictions and not lose bits, and so we are missing safe transformation opportunities.
These patch introduces safety checks for the OverflowingBinaryOperators 'add', 'sub', 'mul' and 'shl', and for the PossiblyExactOperators 'ashr' and 'lshr', enabling new kinds of transformations.


Repository:
  rL LLVM

https://reviews.llvm.org/D46380

Files:
  include/llvm/Analysis/ValueTracking.h
  lib/Analysis/InstructionSimplify.cpp
  lib/Analysis/ValueTracking.cpp
  lib/Transforms/InstCombine/InstCombineAddSub.cpp
  lib/Transforms/InstCombine/InstCombineInternal.h
  lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
  test/Transforms/InstCombine/select-bitext-bitwise-ops.ll
  test/Transforms/InstCombine/select-obo-peo-ops.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46380.144984.patch
Type: text/x-patch
Size: 45587 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180503/62b26e10/attachment.bin>


More information about the llvm-commits mailing list