This is an archive of the discontinued LLVM Phabricator instance.

[SimplifyCFG] Simplify conditions of branches
AbandonedPublic

Authored by mkazantsev on Oct 28 2021, 2:46 AM.

Details

Summary

We can achieve much better results of we use InstSimplify to simplify
conditions. The most iconic example that can be simplified away is
constructions like phi [true][undef] that may appear during the
optimizaitons.

Diff Detail

Event Timeline

mkazantsev created this revision.Oct 28 2021, 2:46 AM
mkazantsev requested review of this revision.Oct 28 2021, 2:46 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 28 2021, 2:46 AM
chill added a comment.Nov 8 2021, 4:38 AM

Look like some of the tests no longer test what they were supposed to test. Some of these could be rewritten in MIR, I suppose.
And/or would it make sense to add test runs with Options.SimplifyCondBranch set to false (somehow), so old tests are not affected?

lkail added a subscriber: lkail.Nov 8 2021, 4:42 AM

Look like some of the tests no longer test what they were supposed to test. Some of these could be rewritten in MIR, I suppose.
And/or would it make sense to add test runs with Options.SimplifyCondBranch set to false (somehow), so old tests are not affected?

And which of them do you think now went completely astray? Skimming through this, I noticed just split-loop.ll which doesn't make sense anymore. What else do you think should be preserved?

nikic added a subscriber: nikic.Nov 9 2021, 12:38 AM

I think this needs a PhaseOrdering test that justifies SimplifyCFG to do InstSimplify's/InstCombine's job.

Look like some of the tests no longer test what they were supposed to test. Some of these could be rewritten in MIR, I suppose.
And/or would it make sense to add test runs with Options.SimplifyCondBranch set to false (somehow), so old tests are not affected?

And which of them do you think now went completely astray? Skimming through this, I noticed just split-loop.ll which doesn't make sense anymore. What else do you think should be preserved?

llvm/test/CodeGen/AArch64/cmp-frameindex.ll will no longer have the frameindex comparison it's supposed to test, llvm/test/CodeGen/AArch64/large-stack-cmp.ll drops the comparison being tested, llvm/test/CodeGen/AArch64/machine-sink-kill-flags.ll no longer has an and to sink, llvm/test/CodeGen/AArch64/optimize-cond-branch.ll doesn't have any of the problematic instructions referenced in the comment anymore. That's the first four tests...

mkazantsev abandoned this revision.Nov 9 2021, 11:02 PM

Ok, I don't care enough.

lkail removed a subscriber: lkail.Nov 9 2021, 11:16 PM