This is an archive of the discontinued LLVM Phabricator instance.

[LoopUnswitch] Trivial simplification: remove trivial dead condition after unswitch
ClosedPublic

Authored by skatkov on Sep 21 2020, 4:04 AM.

Details

Summary

Non trivial loop unswitch can keep the dead condition instruction.
CL adds trivial dead code elimination for unused condition.

Diff Detail

Event Timeline

skatkov created this revision.Sep 21 2020, 4:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 21 2020, 4:04 AM
skatkov requested review of this revision.Sep 21 2020, 4:04 AM
asbirlea accepted this revision.Sep 21 2020, 12:37 PM

I think in general the pass is not trying to do DCE too, but here it looks cheap to clean the dead code left by the conditional.
Please have MSSA updated though.

llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
1156

RecursivelyDeleteTriviallyDeadInstructions(ClonedConditionToErase, nullptr, MSSAU);

This revision is now accepted and ready to land.Sep 21 2020, 12:37 PM
skatkov added inline comments.Sep 21 2020, 6:48 PM
llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
1156

Thanks, will do before landing.