[PATCH] D34162: [InstCombine] Set correct insertion point for selects generated while folding phis

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 16 09:03:29 PDT 2017


spatel added a comment.

The code change looks right, but the test is not minimized, and it's also not checking the more complicated case of a phi with >2 incoming values.

Please double-check my understanding of the bug - is this a better test for the transform and the fix?

  define <2 x i8> @put_selects_in_the_right_blocks(i1 %cond1, i1 %cond2, <2 x i8> %x, <2 x i8> %y, <2 x i8> %z) {
  entry:
    br i1 %cond1, label %if1, label %else
  
  if1:
    br i1 %cond2, label %if2, label %else
  
  if2:
    br label %else
  
  else:
    %phi = phi <2 x i8> [ %y, %if2 ], [ <i8 8, i8 -1>, %entry ], [ <i8 4, i8 1>, %if1 ]
    %cmp = icmp slt <2 x i8> %phi, <i8 7, i8 0>
    %sel = select <2 x i1> %cmp, <2 x i8> %x, <2 x i8> %z
    ret <2 x i8> %sel
  }


https://reviews.llvm.org/D34162





More information about the llvm-commits mailing list