[PATCH] D31526: InstCombine: Use the InstSimplify hook for shufflevector

Zvi Rackover via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 31 01:58:43 PDT 2017


zvi updated this revision to Diff 93604.
zvi added a comment.

Move above the  declaration of MadeChange


Repository:
  rL LLVM

https://reviews.llvm.org/D31526

Files:
  lib/Transforms/InstCombine/InstCombineVectorOps.cpp


Index: lib/Transforms/InstCombine/InstCombineVectorOps.cpp
===================================================================
--- lib/Transforms/InstCombine/InstCombineVectorOps.cpp
+++ lib/Transforms/InstCombine/InstCombineVectorOps.cpp
@@ -1140,12 +1140,11 @@
   SmallVector<int, 16> Mask = SVI.getShuffleMask();
   Type *Int32Ty = Type::getInt32Ty(SVI.getContext());
 
-  bool MadeChange = false;
-
-  // Undefined shuffle mask -> undefined value.
-  if (isa<UndefValue>(SVI.getOperand(2)))
-    return replaceInstUsesWith(SVI, UndefValue::get(SVI.getType()));
+  if (auto *V = SimplifyShuffleVectorInst(LHS, RHS, SVI.getMask(),
+                                          SVI.getType(), DL, &TLI, &DT, &AC))
+    return replaceInstUsesWith(SVI, V);
 
+  bool MadeChange = false;
   unsigned VWidth = SVI.getType()->getVectorNumElements();
 
   APInt UndefElts(VWidth, 0);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31526.93604.patch
Type: text/x-patch
Size: 876 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170331/98adf70c/attachment-0001.bin>


More information about the llvm-commits mailing list