[DAGCombine] visitREM - Don't assume that one divrem isn't driving another
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 13 Mar 2018 17:17:15 +0000 (17:17 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 13 Mar 2018 17:17:15 +0000 (17:17 +0000)
commit9855b3938093eb4a3663474a42a1a694327816c0
tree3045d2a84bc5a492b0afa9277b958b8c0708173d
parent8afcd938ed9cc51dd7db79171d1b06d1e479b3dc
[DAGCombine] visitREM - Don't assume that one divrem isn't driving another

Under some circumstances the divrems won't have been combined together before getting to this code.

So replace the assertion with a if() guard to not expand to X-((X/C)*C) to give the other combine chance to happen.

Reduced from OSS-Fuzz #6883
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6883

llvm-svn: 327424
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/X86/combine-srem.ll