[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:25:20 PDT 2017


zvi created this revision.

Start using the recently added InstSimplify hook for shuffles in the respective InstCombine visitor.


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
@@ -1142,9 +1142,9 @@
 
   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);
 
   unsigned VWidth = SVI.getType()->getVectorNumElements();
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31526.93600.patch
Type: text/x-patch
Size: 707 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170331/0d139224/attachment.bin>


More information about the llvm-commits mailing list