[PATCH] Fold selects when the non-selected elements are undef from shufflevectors
Benjamin Kramer
benny.kra at gmail.com
Fri May 2 14:33:21 PDT 2014
================
Comment at: lib/Transforms/InstCombine/InstCombineSelect.cpp:734
@@ -733,1 +733,3 @@
+static bool CanFoldSelectOfShuffleVectors(SelectInst &SI, Value *CondVal,
+ Value *TrueVal, Value *FalseVal) {
----------------
Argument "SI" is now unused :)
================
Comment at: lib/Transforms/InstCombine/InstCombineSelect.cpp:739
@@ +738,3 @@
+ ShuffleVectorInst *FalseSV = dyn_cast<ShuffleVectorInst>(FalseVal);
+ if (!VecTy && !TrueSV && !FalseSV)
+ return false;
----------------
s/&&/||/g
================
Comment at: lib/Transforms/InstCombine/InstCombineSelect.cpp:750
@@ +749,3 @@
+ // shufflevector(undef, v) into shufflevector(v, undef)
+ if (!(isa<UndefValue>(TrueV2) && isa<UndefValue>(FalseV2)))
+ return false;
----------------
I'd prefer
if (!isa<UndefValue>(TrueV2) || !isa<UndefValue>(FalseV2))
================
Comment at: test/Transforms/InstCombine/select.ll:1037
@@ +1036,3 @@
+; CHECK-LABEL: @add2f_0
+; CHECK-NOT: select
+; CHECK: ret
----------------
Can we have a more positive test case? The mask generation code isn't entirely trivial, would be good to have it verified by a test.
http://reviews.llvm.org/D3561
More information about the llvm-commits
mailing list