This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Restrict a GEP transform to avoid changing provenance
ClosedPublic

Authored by nagisa on Mar 13 2021, 11:56 AM.

Details

Summary

This is an alternative to D98120. Herein, instead of deleting the transformation entirely, we check
that the underlying objects are both the same and therefore this transformation wouldn't incur a
provenance change, if applied.

https://alive2.llvm.org/ce/z/SYF_yv

Diff Detail

Event Timeline

nagisa created this revision.Mar 13 2021, 11:56 AM
nagisa requested review of this revision.Mar 13 2021, 11:56 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 13 2021, 11:56 AM
nagisa edited the summary of this revision. (Show Details)Mar 13 2021, 11:56 AM

Not sure what's up with the other test changes, annotated the POIs with inline comments.

llvm/test/Transforms/InstCombine/getelementptr.ll
1094

This is a genuine test change.

1292

This is a newly added test. This does not optimize at all with -O3 if we remove the transform in question.

nagisa updated this revision to Diff 330465.Mar 13 2021, 12:00 PM

Adjust the differential name in the test case

lebedev.ri added inline comments.Mar 13 2021, 12:03 PM
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
2181–2185
llvm/test/Transforms/InstCombine/getelementptr.ll
1

Please regenerate check lines without this patch and precommit that.

1292

Please precommit the test

nagisa updated this revision to Diff 330471.Mar 13 2021, 1:49 PM

Rebase onto precommited test cases, adjust style

lebedev.ri accepted this revision.Mar 14 2021, 5:51 AM

Alright, LGTM, thank you.

The compile-time impact is surprisingly small:
https://llvm-compile-time-tracker.com/compare.php?from=7ee96429a0b057bcc97331a6a762fc3cd00aed61&to=7a9ffc7e84bb3222bfd0e58144c57ef7b26ebce7&stat=instructions
There are small filesize changes, so this does prevent some of the transformations.

This revision is now accepted and ready to land.Mar 14 2021, 5:51 AM
This revision was landed with ongoing or failed builds.Mar 14 2021, 7:32 AM
This revision was automatically updated to reflect the committed changes.