[InstSimplify] don't crash handling a pointer or aggregate type
llvm-svn: 276345
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index 7e4148c..c7e1724 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -3412,6 +3412,9 @@
Value *FalseVal,
bool TrueWhenUnset) {
unsigned BitWidth = TrueVal->getType()->getScalarSizeInBits();
+ if (!BitWidth)
+ return nullptr;
+
APInt MinSignedValue;
Value *X;
if (match(CmpLHS, m_Trunc(m_Value(X))) && (X == TrueVal || X == FalseVal)) {