aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ValueTracking.cpp
diff options
context:
space:
mode:
authorEli Friedman <efriedma@quicinc.com>2020-04-22 17:15:39 -0700
committerEli Friedman <efriedma@quicinc.com>2020-04-23 17:47:37 -0700
commit3291efc2b3bb7f438f9076f6c4484cadbbda899f (patch)
treebe84d9bcfbcff795b63bd35572b507385a49863b /llvm/lib/Analysis/ValueTracking.cpp
parent1b2c7877a4dd3da2ba7462d65a48341f59c6cc61 (diff)
downloadllvm-3291efc2b3bb7f438f9076f6c4484cadbbda899f.zip
llvm-3291efc2b3bb7f438f9076f6c4484cadbbda899f.tar.gz
llvm-3291efc2b3bb7f438f9076f6c4484cadbbda899f.tar.bz2
[ValueTracking] Handle shufflevector constants in ComputeNumSignBits
Differential Revision: https://reviews.llvm.org/D78688
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index ddce360..056111b 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -2906,7 +2906,11 @@ static unsigned ComputeNumSignBitsImpl(const Value *V,
case Instruction::ShuffleVector: {
// Collect the minimum number of sign bits that are shared by every vector
// element referenced by the shuffle.
- auto *Shuf = cast<ShuffleVectorInst>(U);
+ auto *Shuf = dyn_cast<ShuffleVectorInst>(U);
+ if (!Shuf) {
+ // FIXME: Add support for shufflevector constant expressions.
+ return 1;
+ }
APInt DemandedLHS, DemandedRHS;
// For undef elements, we don't know anything about the common state of
// the shuffle result.