summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2017-03-08 15:02:23 +0000
committerSanjay Patel <spatel@rotateright.com>2017-03-08 15:02:23 +0000
commit62906af379fb6f27b57e28ed3224a50c4242e35c (patch)
tree23cf2b2e17ae8aaa308c8cb5ded1c284347c370d /llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
parent9ef577803870369dcfc0f2074e2302215679269b (diff)
downloadbcm5719-llvm-62906af379fb6f27b57e28ed3224a50c4242e35c.tar.gz
bcm5719-llvm-62906af379fb6f27b57e28ed3224a50c4242e35c.zip
[InstCombine] avoid crashing on shuffle shrinkage when input type is not same as result type
llvm-svn: 297280
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
index e082cc30196..e43e721534e 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
@@ -470,7 +470,8 @@ static Instruction *shrinkSplatShuffle(TruncInst &Trunc,
InstCombiner::BuilderTy &Builder) {
auto *Shuf = dyn_cast<ShuffleVectorInst>(Trunc.getOperand(0));
if (Shuf && Shuf->hasOneUse() && isa<UndefValue>(Shuf->getOperand(1)) &&
- Shuf->getMask()->getSplatValue()) {
+ Shuf->getMask()->getSplatValue() &&
+ Shuf->getType() == Shuf->getOperand(0)->getType()) {
// trunc (shuf X, Undef, SplatMask) --> shuf (trunc X), Undef, SplatMask
Constant *NarrowUndef = UndefValue::get(Trunc.getType());
Value *NarrowOp = Builder.CreateTrunc(Shuf->getOperand(0), Trunc.getType());
OpenPOWER on IntegriCloud