From 15f869238140e45f4a9331429bd42f1254e77259 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Thu, 23 Aug 2018 17:15:02 +0000 Subject: [ValueTracking] Fix an assert from r340480. We need to allow ConstantExpr Selects in addition to SelectInst. I'll try to put together a test case, but I wanted to fix the issues being reported. Fixes PR38677 llvm-svn: 340546 --- llvm/lib/Analysis/ValueTracking.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Analysis/ValueTracking.cpp') diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index 322d5c2..d2844d8 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -2213,7 +2213,9 @@ bool MaskedValueIsZero(const Value *V, const APInt &Mask, unsigned Depth, // Returns the input and lower/upper bounds. static bool isSignedMinMaxClamp(const Value *Select, const Value *&In, const APInt *&CLow, const APInt *&CHigh) { - assert(isa(Select) && "Input should be a SelectInst!"); + assert(isa(Select) && + cast(Select)->getOpcode() == Instruction::Select && + "Input should be a SelectInst!"); const Value *LHS, *RHS, *LHS2, *RHS2; SelectPatternFlavor SPF = matchSelectPattern(Select, LHS, RHS).Flavor; -- cgit v1.1