This is an archive of the discontinued LLVM Phabricator instance.

[LV] Do not try to sink dead instructions.
ClosedPublic

Authored by fhahn on Jan 25 2020, 5:10 PM.

Details

Summary

Dead instructions do not need to be sunk. Currently we try and record
the recipies for them, but there are no recipes emitted for them and
there's nothing to sink. They can be removed from SinkAfter while
marking them for recording.

Fixes PR44634.

Diff Detail

Event Timeline

fhahn created this revision.Jan 25 2020, 5:10 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 25 2020, 5:10 PM
fhahn updated this revision to Diff 240404.Jan 25 2020, 5:12 PM

Update test checks

Unit tests: fail. 62194 tests passed, 1 failed and 815 were skipped.

failed: LLVM.Transforms/LoopVectorize/first-order-recurrence.ll

clang-tidy: pass.

clang-format: pass.

Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.

Unit tests: pass. 62195 tests passed, 0 failed and 815 were skipped.

clang-tidy: pass.

clang-format: pass.

Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.

Harbormaster completed remote builds in B44935: Diff 240404.
gilr added inline comments.Jan 26 2020, 4:09 AM
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
7170

How about cleaning sink-after once, immediately after calling collectTriviallyDeadInstrucions()?

7172

DeadInstructions.count()?

7199

Independently, this belongs in collectTriviallyDeadInstructions(), right?

7231

DeadInstructions.count()?

fhahn updated this revision to Diff 240460.Jan 26 2020, 5:42 PM

Address comments.

fhahn marked 4 inline comments as done.Jan 26 2020, 5:46 PM
fhahn added inline comments.
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
7170

Done, I've moved it to the caller.

7172

I am never sure which version is really preferable. I think find() makes it a bit more explicit. But I can change it to count if that's preferred, as there can be no duplicate keys in dense maps

7199

I am not sure if it makes sense to put them there. As indicated in the comment, we really should handle them properly. They are not really dead, it's more that dropping them is the easiest way to handle them legally and adding them to DeadInstructions is the quickest way to not add them to the plan.

It should be initialized in the caller though I think. I'll put that up as a follow-up change.

7231

I can update it, if preferred.

Unit tests: pass. 62198 tests passed, 0 failed and 815 were skipped.

clang-tidy: pass.

clang-format: pass.

Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.

gilr added inline comments.Jan 27 2020, 5:05 AM
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
7135

How about:

for (auto *Dead : DeadInstructions)
  SinkAfter.erase(Dead);

Would also facilitate filtering dead instructions from other maps if needed.

fhahn updated this revision to Diff 240612.Jan 27 2020, 9:00 AM
fhahn marked an inline comment as done.

Iterate over DeadInstructions instead.

Unit tests: pass. 62222 tests passed, 0 failed and 816 were skipped.

clang-tidy: pass.

clang-format: fail. Please format your changes with clang-format by running git-clang-format HEAD^ or applying this patch.

Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml

Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.

gilr accepted this revision.Jan 27 2020, 10:20 PM

LGTM!

This revision is now accepted and ready to land.Jan 27 2020, 10:20 PM
This revision was automatically updated to reflect the committed changes.
fhahn marked an inline comment as done.Jan 28 2020, 8:55 AM
fhahn added inline comments.
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
7199

I've pushed a commit moving this to the caller https://reviews.llvm.org/rGd1f849a284d9