This is an archive of the discontinued LLVM Phabricator instance.

[SLP] fix verification check for valid IR
ClosedPublic

Authored by spatel on May 21 2020, 1:04 PM.

Details

Summary

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.

The test that is altered here could be fixed independently because the incoming input metadata is invalid. AFAICT, that fix does not change the motivation for that test. The test was escaping verification in SLP without this change because we were not running verifyFunction() unless SLP actually changed the IR.

Note: "-disable-verify" on the RUN line doesn't seem to suppress the verifyFunction; not sure if that's another bug.

Diff Detail

Event Timeline

spatel created this revision.May 21 2020, 1:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 21 2020, 1:04 PM
This revision is now accepted and ready to land.May 21 2020, 1:41 PM
This revision was automatically updated to reflect the committed changes.

This change caused verification to catch "invalid" IR produced by instcombine. Filed a bug for that https://bugs.llvm.org/show_bug.cgi?id=46362