[PATCH] D53972: [ARM][CGP] Negative constant operand handling

Sam Parker via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 1 02:01:03 PDT 2018


samparker created this revision.
samparker added reviewers: SjoerdMeijer, olista01.
Herald added subscribers: chrib, kristof.beyls, javed.absar, srhines.

While mutating instructions, we sign extended negative constant operands for binary operators that can safely overflow. This was to allow instructions, such as add nuw i8 %a, -2, to still be able to perform a subtraction. However, the code to handle constants doesn't take into consideration that instructions, such as sub nuw i8 -2, %a, require the i8 -2 to be converted into i32 254.

This is a relatively simple fix, but I've taken the time to reorganise the code a bit - mainly that instructions that can be promoted are cached.


https://reviews.llvm.org/D53972

Files:
  lib/Target/ARM/ARMCodeGenPrepare.cpp
  test/CodeGen/ARM/CGP/arm-cgp-calls.ll
  test/CodeGen/ARM/CGP/arm-cgp-casts.ll
  test/CodeGen/ARM/CGP/arm-cgp-icmps.ll
  test/CodeGen/ARM/CGP/arm-cgp-overflow.ll
  test/CodeGen/ARM/CGP/arm-cgp-phis-ret.ll
  test/CodeGen/ARM/CGP/arm-cgp-pointers.ll
  test/CodeGen/ARM/CGP/arm-cgp-signed-icmps.ll
  test/CodeGen/ARM/CGP/arm-cgp-signed.ll
  test/CodeGen/ARM/arm-cgp-calls.ll
  test/CodeGen/ARM/arm-cgp-casts.ll
  test/CodeGen/ARM/arm-cgp-icmps.ll
  test/CodeGen/ARM/arm-cgp-overflow.ll
  test/CodeGen/ARM/arm-cgp-phis-ret.ll
  test/CodeGen/ARM/arm-cgp-pointers.ll
  test/CodeGen/ARM/arm-cgp-signed-icmps.ll
  test/CodeGen/ARM/arm-cgp-signed.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53972.172096.patch
Type: text/x-patch
Size: 101603 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181101/3512a82a/attachment.bin>


More information about the llvm-commits mailing list