This is an archive of the discontinued LLVM Phabricator instance.

[SimpleLoopUnswitch] Enable freezing of conditions by default.
ClosedPublic

Authored by fhahn on Apr 22 2022, 5:14 AM.

Details

Summary

This fixes a series of mis-compiles by SimpleLoopUnswitch.

My measurements showed no performance regression with -O3 on AArch64
in SPEC2006, SPEC2017 and a set of internal benchmarks.

Fixes #50387, #50430

Depends on D124251.

Diff Detail

Event Timeline

fhahn created this revision.Apr 22 2022, 5:14 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 22 2022, 5:14 AM
fhahn requested review of this revision.Apr 22 2022, 5:14 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 22 2022, 5:14 AM
nikic accepted this revision.Apr 22 2022, 5:33 AM

LGTM

This revision is now accepted and ready to land.Apr 22 2022, 5:33 AM
aqjune accepted this revision.Apr 22 2022, 8:19 AM

Thank you for your work..! The diff looks fine.

A quick question: should LoopUnswitch.cpp be fixed as well? It seems the pass is not maintained though. Will SimpleLoopUnswitch supercede the LoopUnswitch pass?

nikic added a comment.Apr 23 2022, 1:49 AM

I believe LoopUnswitch is only used in the legacy PM, so we should probably just delete the pass.

fhahn added a comment.Apr 23 2022, 4:22 AM

I believe LoopUnswitch is only used in the legacy PM, so we should probably just delete the pass.

Yes, the pass should effectively be dead code with the move to the new PM and I don't think we should spend any time on updating it. I'll put up a patch to remove it.

It sounds great - then after the removal of the old pass I will make a patch that removes https://github.com/llvm/llvm-project/blob/main/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp#L2508 as well.

fhahn added a comment.Apr 25 2022, 3:51 AM

I believe LoopUnswitch is only used in the legacy PM, so we should probably just delete the pass.

Yes, the pass should effectively be dead code with the move to the new PM and I don't think we should spend any time on updating it. I'll put up a patch to remove it.

Patch is available: D124376

This revision was landed with ongoing or failed builds.Apr 25 2022, 6:27 AM
This revision was automatically updated to reflect the committed changes.