This is an archive of the discontinued LLVM Phabricator instance.

[MergeICmps] Disable if a GEP does not reference an Argument
AbandonedPublic

Authored by MaskRay on Nov 30 2020, 10:09 PM.

Details

Reviewers
courbet
jyknight
Summary

If the pointer operand of a GEP references an instruction defined in a
deleted basic block, after cloning of the GEP and the removal of the
basic block, the GEP will reference undef.

This caused a miscompile which motivated my D92297 (before D17993,
nonnull and dereferenceable attributed were not added so MergeICmps were
not triggered.) The new test gep-references-bb.ll demonstrate the issue.

Note: in LLVM 8.0, opt does not delete basic blocks (thus %gep is retained) and
insert new basic blocks. opt can actually optimize gep-references-bb.ll to use a
memcmp. We should try making the test profitable again.

Diff Detail

Event Timeline

MaskRay created this revision.Nov 30 2020, 10:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 30 2020, 10:09 PM
MaskRay requested review of this revision.Nov 30 2020, 10:09 PM
MaskRay updated this revision to Diff 308541.

Add log

MaskRay updated this revision to Diff 308542.Nov 30 2020, 10:11 PM

Placed LLVM_DEBUG in the wrong place in the previous diff...

Harbormaster completed remote builds in B80611: Diff 308540.

Thanks for the repro. I think a better fix is D92375 (missing split).

MaskRay abandoned this revision.Dec 1 2020, 9:02 AM