[TargetLowering] optimizeSetCCToComparisonWithZero(): add extra sanity checks (PR43769)
authorRoman Lebedev <lebedev.ri@gmail.com>
Wed, 23 Oct 2019 08:58:50 +0000 (11:58 +0300)
committerRoman Lebedev <lebedev.ri@gmail.com>
Wed, 23 Oct 2019 09:01:40 +0000 (12:01 +0300)
commit20bf0cf2f020ce3b344838b88d8a86e156c05443
tree0961afc31652a7e4a3c49cf5aa8e084be62c616b
parentd052a578de58cbbb638cbe2dba05242d1ff443b9
[TargetLowering] optimizeSetCCToComparisonWithZero(): add extra sanity checks (PR43769)

We should do the fold only if both constants are plain,
non-opaque constants, at least that is the DAG.FoldConstantArithmetic()
requirement.
And if the constant we are comparing with is zero - we shouldn't be
trying to do this fold in the first place.

Fixes https://bugs.llvm.org/show_bug.cgi?id=43769
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
llvm/test/CodeGen/X86/pr43769.ll [new file with mode: 0644]