OSDN Git Service

Implement XOR reassociation. It is based on following rules:
authorShuxin Yang <shuxin.llvm@gmail.com>
Sat, 30 Mar 2013 02:15:01 +0000 (02:15 +0000)
committerShuxin Yang <shuxin.llvm@gmail.com>
Sat, 30 Mar 2013 02:15:01 +0000 (02:15 +0000)
commit2d1001064989b7fa79507816fc17d467fc00a2f2
treee3c8439a9ceb4c9c26310700dbfac856be5d2d3b
parentfd2cd0db97d78e10288bdf0fb915296c68294237
Implement XOR reassociation. It is based on following rules:

  rule 1: (x | c1) ^ c2 => (x & ~c1) ^ (c1^c2),
     only useful when c1=c2
  rule 2: (x & c1) ^ (x & c2) = (x & (c1^c2))
  rule 3: (x | c1) ^ (x | c2) = (x & c3) ^ c3 where c3 = c1 ^ c2
  rule 4: (x | c1) ^ (x & c2) => (x & c3) ^ c1, where c3 = ~c1 ^ c2

 It reduces an application's size (in terms of # of instructions) by 8.9%.
 Reviwed by Pete Cooper. Thanks a lot!

 rdar://13212115

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178409 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/Reassociate.cpp
test/Transforms/Reassociate/xor_reassoc.ll [new file with mode: 0644]