This is an archive of the discontinued LLVM Phabricator instance.

[SimpleLoopUnswitch] Invalidate the topmost loop with ExitBB as exiting.
ClosedPublic

Authored by fhahn on Nov 27 2019, 7:46 AM.

Details

Summary

SCEV caches the exiting blocks when computing exit counts. In
SimpleLoopUnswitch, we split the exit block of the loop to unswitch.

Currently we only invalidate the loop containing that exit block, but if
that block is the exiting block for a parent loop, we have stale cache
entries. We have to invalidate the top-most loop that contains the exit
block as exiting block. We might also be able to skip invalidating the
loop containing the exit block, if the exit block is not an exiting
block of that loop.

There are also 2 more places in SimpleLoopUnswitch, that use a similar
problematic approach to get the loop to invalidate. If the patch makes
sense, I will also update those places to a similar approach (they deal
with multiple exit blocks, so we cannot directly re-use
getTopMostExitingLoop).

Diff Detail

Event Timeline

fhahn created this revision.Nov 27 2019, 7:46 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 27 2019, 7:46 AM

Build result: fail - 60324 tests passed, 15 failed and 732 were skipped.

failed: LLVM.Analysis/MemorySSA/pr40037.ll
failed: LLVM.Transforms/SimpleLoopUnswitch/2006-06-13-SingleEntryPHI.ll
failed: LLVM.Transforms/SimpleLoopUnswitch/2007-05-09-Unreachable.ll
failed: LLVM.Transforms/SimpleLoopUnswitch/2012-04-30-LoopUnswitch-LPad-Crash.ll
failed: LLVM.Transforms/SimpleLoopUnswitch/LIV-loop-condtion.ll
failed: LLVM.Transforms/SimpleLoopUnswitch/cleanuppad.ll
failed: LLVM.Transforms/SimpleLoopUnswitch/copy-metadata.ll
failed: LLVM.Transforms/SimpleLoopUnswitch/formDedicatedAfterTrivial1.ll
failed: LLVM.Transforms/SimpleLoopUnswitch/guards.ll
failed: LLVM.Transforms/SimpleLoopUnswitch/infinite-loop.ll
failed: LLVM.Transforms/SimpleLoopUnswitch/msan.ll
failed: LLVM.Transforms/SimpleLoopUnswitch/nontrivial-unswitch.ll
failed: LLVM.Transforms/SimpleLoopUnswitch/pr37888.ll
failed: LLVM.Transforms/SimpleLoopUnswitch/trivial-unswitch-iteration.ll
failed: LLVM.Transforms/SimpleLoopUnswitch/trivial-unswitch.ll

Log files: console-log.txt, CMakeCache.txt

fhahn updated this revision to Diff 231277.Nov 27 2019, 9:01 AM

Account for Current being nullptr initially.

Build result: pass - 60354 tests passed, 0 failed and 732 were skipped.

Log files: console-log.txt, CMakeCache.txt

asbirlea accepted this revision.Dec 3 2019, 9:49 AM

Thank you for this fix. LGTM.

This revision is now accepted and ready to land.Dec 3 2019, 9:49 AM
This revision was automatically updated to reflect the committed changes.