[PATCH] Teach DAGCombiner to fold inverted bit tests

Rafael EspĂ­ndola rafael.espindola at gmail.com
Mon May 6 13:01:00 PDT 2013


On 6 May 2013 15:37, David Majnemer <david.majnemer at gmail.com> wrote:
> It cannot go into InstCombine because then it would be in a non-canonical
> form, SimplifyDemandedUseBits will undo the operation.

That is a bit strange. On the patch itself, don't you have to put

define i32 @test9(i32 %a) #0 {
  %1 = and i32 %a, 4096
  %2 = xor i32 %1, 4096
  ret i32 %2
}

as the testcase? With

define i32 @test9(i32 %a) nounwind {
  %1 = xor i32 %a, -1
  %2 = and i32 %1, 4096
  ret i32 %2
}


llc is already producing

notl %edi
andl $4096, %edi

Cheers,
Rafael



More information about the llvm-commits mailing list