diff options
| author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2017-12-28 09:35:35 +0000 |
|---|---|---|
| committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2017-12-28 09:35:35 +0000 |
| commit | 472689a159e6e2d455724d28eef35554daa6667b (patch) | |
| tree | f90a9de5aae25898643acdecd7dcb87e28316655 /llvm/lib | |
| parent | 5a81bb73ad04277411b007a20a5c95b87c775fe6 (diff) | |
| download | bcm5719-llvm-472689a159e6e2d455724d28eef35554daa6667b.tar.gz bcm5719-llvm-472689a159e6e2d455724d28eef35554daa6667b.zip | |
[InstCombine] Check for isa<Instruction> before using cast<>
Protects against casts from constexpr etc.
Reduced from oss-fuzz #4788 test case
llvm-svn: 321515
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
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<Instruction>(Arg0) && cast<Instruction>(Arg0)->getFastMathFlags().noInfs())) { if (Arg0IsZero) std::swap(A, B); |

