[PATCH] D41354: [InstCombine] Extending InstructionSimplify

Omer Paparo Bivas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 21 08:05:58 PST 2017


opaparo updated this revision to Diff 127889.
opaparo added a comment.

1. Generalized InstructionSimplify's IsSafeOverflowingBinaryOperator to handle 'add', 'sub' and 'mul' in addition to 'shl'. This was done by refactoring existing behavior out of InstCombine's internals into ValueTracking, so now both InstCombine and InstructionSimplify use it.
2. Added tests to cover possible cases. For each OverflowingBinaryOperator ('shl', 'add', 'sub' and 'mul') I've created tests according to the Cartesian product of four factors: the op has the nuw flag, the op has the nsw flag, there actually is an unsigned overflow, there actually is a signed overflow. The key idea is to check that optimizations occur if and only if the overflow flag is absent or no overflow is guaranteed. also note that the file name had changed from select-bitext-bitwise-ops.ll to select-obo-peo-ops.ll to better reflect the nature of the tests it contains.




Repository:
  rL LLVM

https://reviews.llvm.org/D41354

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: D41354.127889.patch
Type: text/x-patch
Size: 59184 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171221/2af8ab14/attachment.bin>


More information about the llvm-commits mailing list