[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:21:02 PDT 2017


spatel added a comment.

I don't think we even need the cmp:

  define <2 x i8> @pull_vector_select_constants_through_phi(i1 %cond1, i1 %cond2, <2 x i1> %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 i1> [ %x, %if2 ], [ <i1 0, i1 1>, %entry ], [ <i1 1, i1 0>, %if1 ]
    %sel = select <2 x i1> %phi, <2 x i8> %y, <2 x i8> %z
    ret <2 x i8> %sel
  }

This test actually raises a question about this transform independent of the bug. The transform can increase the number of IR instructions - is that expected?


https://reviews.llvm.org/D34162





More information about the llvm-commits mailing list