[PATCH] D30741: [DAG] recognize div/rem by 0 as undef before trying constant folding
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 8 08:36:41 PST 2017
spatel created this revision.
Herald added a subscriber: mcrosier.
As discussed in the review thread for https://reviews.llvm.org/rL297026, this is actually 2 changes that would independently fix all of the test cases in the patch:
1. Return undef in FoldConstantArithmetic for div/rem by 0.
2. Move basic undef simplifications for div/rem (simplifyDivRem()) before foldBinopIntoSelect() as a matter of efficiency.
I can split it up, but I'm not sure yet how to expose the failures once either one of the fixes goes in.
I will handle the case of vectors with any zero element as a follow-up unless we want to do it all in one step. That change is the DAG sibling for https://reviews.llvm.org/D30665 + adding a check of vector elements to FoldConstantArithmetic().
There are likely more improvements for undef handling needed for functions like isConstantSplatVector(), so I can also try to fix those too.
https://reviews.llvm.org/D30741
Files:
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
test/CodeGen/X86/div-rem-simplify.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30741.91023.patch
Type: text/x-patch
Size: 5167 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170308/5c529464/attachment.bin>
More information about the llvm-commits
mailing list