[CodeGen] Check FoldConstantArithmetic result before using it.
authorAhmed Bougacha <ahmed.bougacha@gmail.com>
Thu, 27 Aug 2015 21:46:04 +0000 (21:46 +0000)
committerAhmed Bougacha <ahmed.bougacha@gmail.com>
Thu, 27 Aug 2015 21:46:04 +0000 (21:46 +0000)
commit69019c5399ca9ddfb9ab72366008ec693d3956ec
tree5801896800a5f909ab337394973295daba068147
parentbfe0f6957bccfcde83f323aec4d3a164bc0c3c7d
[CodeGen] Check FoldConstantArithmetic result before using it.

Fixes PR24602: r245689 introduced an unguarded use of
SelectionDAG::FoldConstantArithmetic, which returns 0 when it fails
because of opaque (hoisted) constants.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246217 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
test/CodeGen/X86/pr24602.ll [new file with mode: 0644]