[SLP] fix verification check for valid IR
authorSanjay Patel <spatel@rotateright.com>
Fri, 22 May 2020 13:12:06 +0000 (09:12 -0400)
committerSanjay Patel <spatel@rotateright.com>
Fri, 22 May 2020 13:15:27 +0000 (09:15 -0400)
commit21f7cf4057b75ac3bc46597415499dd0fc214e97
treedf5187f3fa55560758f72af55bc6875b1bc6a0ad
parent99b94f29ac5dbbce0585d16f631359a66f279ea4
[SLP] fix verification check for valid IR

This is a fix for PR45965 - https://bugs.llvm.org/show_bug.cgi?id=45965 -
which was left out of D80106 because of a test failure.

SLP does its own mini-CSE after potentially creating redundant instructions,
so we need to wait for that to complete before running the verifier.
Otherwise, we will see a test failure for
test/Transforms/SLPVectorizer/X86/crash_vectorizeTree.ll (not changed here)
because a phi temporarily has identical but different incoming values for
the same incoming block.

A related, but independent, test that would have been altered here was
fixed with:
rG880df55

The test was escaping verification in SLP without this change because we
were not running verifyFunction() unless SLP actually changed the IR.

Differential Revision: https://reviews.llvm.org/D80401
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp