[PATCH] D46086: [InstCombine] refine select-of-constants to bitwise ops

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 25 15:07:11 PDT 2018


spatel added a comment.

The bit hackery isn't clear to me even after staring at this all day. Here's the Alive link I posted earlier in case it helps:
https://rise4fun.com/Alive/XG7
Suggestions to improve the comments and code welcome.

Also, the tests reveal a couple of simpler but non-obvious folds that we seem to be missing:
https://rise4fun.com/Alive/AeL

  Name: add_to_xor
  %a = and i8 %x, 128
  %r = add i8 %a, 131
  =>
  %r = xor i8 %a, 131
  
  Name: orxor
  %a = or i8 %x, -9
  %r = xor i8 %a, 8
  =>
  %a1 = xor i8 %x, -1
  %r = or i8 %a1, -9


https://reviews.llvm.org/D46086





More information about the llvm-commits mailing list