This is an archive of the discontinued LLVM Phabricator instance.

[DSE] Relax constraint on isGuaranteedLoopInvariant
ClosedPublic

Authored by StephenFan on Oct 6 2022, 8:09 AM.

Details

Summary

If the location ptr to be killed is in no loop and the Function does not
have irreducible loops, then we can regard it as loop invariant.

Diff Detail

Event Timeline

StephenFan created this revision.Oct 6 2022, 8:09 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 6 2022, 8:09 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
StephenFan requested review of this revision.Oct 6 2022, 8:09 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 6 2022, 8:09 AM
nikic added inline comments.Oct 7 2022, 1:06 AM
llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
1202

Spurious newline? This should either be one line higher or not exist.

1218–1221

I wonder whether we should retain the entry block check as well. That would make sure that even with irreducible cycles we will at least handle the important case of (constant geps of) allocas.

  1. Add a testcase
  2. Check isEntryBlock no matter if contains irreducible loops
nikic accepted this revision.Oct 9 2022, 12:59 AM

LGTM

This revision is now accepted and ready to land.Oct 9 2022, 12:59 AM
This revision was landed with ongoing or failed builds.Oct 9 2022, 9:10 AM
This revision was automatically updated to reflect the committed changes.