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

Zvi Rackover via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 3 22:00:34 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL299412: InstCombine: Use the InstSimplify hook for shufflevector (authored by zvi).

Changed prior to commit:
  https://reviews.llvm.org/D31526?vs=93604&id=94002#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D31526

Files:
  llvm/trunk/lib/Transforms/InstCombine/InstCombineVectorOps.cpp


Index: llvm/trunk/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
===================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
+++ llvm/trunk/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.94002.patch
Type: text/x-patch
Size: 909 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170404/4a043ad1/attachment.bin>


More information about the llvm-commits mailing list