From 472689a159e6e2d455724d28eef35554daa6667b Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Thu, 28 Dec 2017 09:35:35 +0000 Subject: [InstCombine] Check for isa before using cast<> Protects against casts from constexpr etc. Reduced from oss-fuzz #4788 test case llvm-svn: 321515 --- llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm/lib') diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp index 5e0778d9ae2..40e52ee755e 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -2376,7 +2376,7 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) { // The compare intrinsic uses the above assumptions and therefore // doesn't require additional flags. if ((match(Arg0, m_OneUse(m_FSub(m_Value(A), m_Value(B)))) && - match(Arg1, m_Zero()) && + match(Arg1, m_Zero()) && isa(Arg0) && cast(Arg0)->getFastMathFlags().noInfs())) { if (Arg0IsZero) std::swap(A, B); -- cgit v1.2.3