llvm-project/llvm/test/Transforms/Reassociate
Sanjay Patel f5ead29b78 [PatternMatch] Handle undef vectors consistently
This patch fixes the issue noticed in D54532. 
The problem is that cst_pred_ty-based matchers like m_Zero() currently do not match 
scalar undefs (as expected), but *do* match vector undefs. This may lead to optimization 
inconsistencies in rare cases.

There is only one existing test for which output changes, reverting the change from D53205. 
The reason here is that vector fsub undef, %x is no longer matched as an m_FNeg(). While I 
think that the new output is technically worse than the previous one, it is consistent with 
scalar, and I don't think it's really important either way (generally that undef should have 
been folded away prior to reassociation.)

I've also added another test case for this issue based on InstructionSimplify. It took some 
effort to find that one, as in most cases undef folds are either checked first -- and in the 
cases where they aren't it usually happens to not make a difference in the end. This is the 
only case I was able to come up with. Prior to this patch the test case simplified to undef 
in the scalar case, but zeroinitializer in the vector case.

Patch by: @nikic (Nikita Popov)

Differential Revision: https://reviews.llvm.org/D54631

llvm-svn: 347318
2018-11-20 16:08:19 +00:00
..
2002-05-15-AgressiveSubMove.ll
2002-05-15-MissedTree.ll
2002-05-15-SubReassociate.ll
2002-07-09-DominanceProblem.ll
2003-08-12-InfiniteLoop.ll
2005-09-01-ArrayOutOfBounds.ll
2006-04-27-ReassociateVector.ll
2011-01-26-UseAfterFree.ll
2012-05-08-UndefLeak.ll
2012-06-08-InfiniteLoop.ll
absorption.ll [Reassociate] add test for missing FP constant analysis; NFC 2018-07-03 15:56:04 +00:00
add_across_block_crash.ll
basictest.ll [Reassociate] regenerate checks; NFC 2018-07-03 16:01:41 +00:00
binop-identity.ll [Constants] add identity constants for fadd/fmul 2018-07-03 17:12:59 +00:00
canonicalize-neg-const.ll
commute.ll
crash.ll
crash2.ll
deadcode.ll
erase_inst_made_change.ll
factorize-again.ll
fast-AgressiveSubMove.ll
fast-ArrayOutOfBounds.ll
fast-MissedTree.ll
fast-ReassociateVector.ll
fast-SubReassociate.ll
fast-basictest.ll
fast-fp-commute.ll
fast-mightymul.ll
fast-multistep.ll
fp-commute.ll
fp-expr.ll [PatternMatch] Handle undef vectors consistently 2018-11-20 16:08:19 +00:00
infloop-deadphi.ll [Reassociate] Prevent infinite loops when processing PHIs. 2018-05-11 15:45:36 +00:00
inverses.ll [Reassociate] replace fake binop queries with 'match' API 2018-10-23 15:55:06 +00:00
keep-debug-loc.ll
long-chains.ll [reassociate] Fix excessive revisits when processing long chains of reassociatable instructions. 2018-05-02 17:59:16 +00:00
looptest.ll
matching-binops.ll revert r341288 - [Reassociate] swap binop operands to increase factoring potential 2018-09-12 21:29:11 +00:00
mightymul.ll
min_int.ll
mixed-fast-nonfast-fp.ll
mulfactor.ll
multistep.ll
negation.ll [Reassociate] replace fake binop queries with 'match' API 2018-10-23 15:55:06 +00:00
negation1.ll [Reassociate] add vector tests with undef elements; NFC 2018-10-22 22:04:13 +00:00
no-op.ll
optional-flags.ll
otherops.ll
pr12245.ll
pr21205.ll
pr28367.ll
propagate-flags.ll
reassoc-intermediate-fnegs.ll [Constants] add identity constants for fadd/fmul 2018-07-03 17:12:59 +00:00
reassociate-deadinst.ll
reassociate_dbgvalue_discard.ll [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
repeats.ll
secondary.ll
shift-factor.ll
shifttest.ll
subtest.ll
vaarg_movable.ll
wrap-flags.ll
xor_reassoc.ll