This is an archive of the discontinued LLVM Phabricator instance.

[Pipelines] Move SimplifyCFGPass in front of InstCombinePass.
AbandonedPublic

Authored by DianQK on Apr 21 2023, 8:19 PM.

Details

Summary

Fix https://github.com/llvm/llvm-project/issues/62238. Bisected to D138542.
For https://llvm.godbolt.org/z/1njhb7EYW, it is difficult for us to optimize to batter instructions after InstSimplifyPass.

I found the pipeline usually created a pair of SimplifyCFGPass + InstCombinePass. This position adjustment seems reasonable also. It's should fine to have fewer nonsense instructions before InstCombinePass.
I'm learning about the pipeline-related code for the first time and hope it hasn't affected more beneficial optimizations.

Diff Detail

Event Timeline

DianQK created this revision.Apr 21 2023, 8:19 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 21 2023, 8:19 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
DianQK requested review of this revision.Apr 21 2023, 8:19 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 21 2023, 8:19 PM
DianQK edited the summary of this revision. (Show Details)Apr 21 2023, 8:58 PM
DianQK added reviewers: bcl5980, nikic, StephenFan, spatel.
DianQK updated this revision to Diff 516022.Apr 21 2023, 9:00 PM

Formatting code.

nikic requested changes to this revision.Apr 22 2023, 12:35 AM

The pattern folds fine in isolation (https://alive2.llvm.org/ce/z/WfqQwW), so I don't understand why a phase ordering change would be needed for this. Most likely this just needs a special case in simplifyWithOpReplaced(), to say that the derefining replacement is safe in this case, based on poison implication.

This revision now requires changes to proceed.Apr 22 2023, 12:35 AM
DianQK planned changes to this revision.Apr 22 2023, 6:55 AM

Thanks, I understand. I will submit another patch if possible.

DianQK abandoned this revision.May 16 2023, 4:26 AM