[PATCH] D25485: [DAG] optimize negation of bool

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 14 14:32:36 PDT 2016


spatel updated this revision to Diff 74742.
spatel added a comment.
Herald added a subscriber: nemanjai.

Patch upated:
Use mask+negate universally via LegalizeDAG.

There are improvements in the tests for x86, PPC, ARM, and MIPS. 
SystemZ looks neutral to me, but I have no experience with that target. I assume it would see the same improvement (optimize away the mask) if we added tests for that. 
There's an extra 'negu' in the MIPS select test. I didn't check to see what is going on there. 
Based on the earlier comments, I think we're ok with an added instruction in the microMIPS cases as long as there's a reduction in the code size.


https://reviews.llvm.org/D25485

Files:
  lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
  test/CodeGen/ARM/negate-i1.ll
  test/CodeGen/Mips/llvm-ir/add.ll
  test/CodeGen/Mips/llvm-ir/mul.ll
  test/CodeGen/Mips/llvm-ir/sdiv.ll
  test/CodeGen/Mips/llvm-ir/srem.ll
  test/CodeGen/Mips/llvm-ir/sub.ll
  test/CodeGen/Mips/llvm-ir/urem.ll
  test/CodeGen/Mips/select.ll
  test/CodeGen/PowerPC/negate-i1.ll
  test/CodeGen/SystemZ/branch-07.ll
  test/CodeGen/SystemZ/risbg-01.ll
  test/CodeGen/SystemZ/shift-10.ll
  test/CodeGen/X86/negate-i1.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25485.74742.patch
Type: text/x-patch
Size: 23544 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161014/de8c5b30/attachment.bin>


More information about the llvm-commits mailing list