This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Avoid instruction sinking if not profitable for other passes
AbandonedPublic

Authored by xbolva00 on Oct 10 2018, 10:35 AM.

Details

Reviewers
efriedma
spatel
Summary

Part of PR39119

Diff Detail

Event Timeline

xbolva00 created this revision.Oct 10 2018, 10:35 AM
xbolva00 updated this revision to Diff 169078.Oct 10 2018, 1:16 PM
  • Fixed formatting
xbolva00 updated this revision to Diff 169080.Oct 10 2018, 1:32 PM

simplify test cases

xbolva00 updated this revision to Diff 169090.Oct 10 2018, 2:02 PM
  • Check if null pointer is defined

@efriedma, Is this acceptable or not? In the future, the instruction sinking would be moved out of instcombine, but the call inst sinking problem needs to be solved anyway. I don't think we should disable call inst sinking totally.

I see that there were some perf numbers in https://bugs.llvm.org/show_bug.cgi?id=39119#c11,
but those are global, not for this patch. Anything for this change specifically?

test/Transforms/InstCombine/no-sink-nonnull-args.ll
1

Please precommit the test. It isn't obvious what the diff changes here.
No existing tests change?

I will precommit them if folks say this is fine direction to go.

If we sink the call instructions, Florian's new SCCP patches related to null checks optimizations are unable to benefit from the dominating call with nonnull args.

Florian disabled sinking to see the potential of his new SCCP optimizations, but we need a stronger solution (to not regress in other areas).

I will precommit them if folks say this is fine direction to go.

If no existing test is affected by this, you most likely want the tests anyway.

If we sink the call instructions, Florian's new SCCP patches related to null checks optimizations are unable to benefit from the dominating call with nonnull args.

Florian disabled sinking to see the potential of his new SCCP optimizations, but we need a stronger solution (to not regress in other areas).

xbolva00 abandoned this revision.EditedOct 11 2018, 12:39 PM

Ok, the problem I have is not related with sinking. Closing this revision.

I want to mark call sites of C functions with nonnull attr. like "strlen (nonnull s)". But since EnableNonnullArgPropagation is disabled, the attrs are not promoted to parent function arguments. And that's the reason why my motivating example from PR39119 with strcmp is not optimized :(

I still think if we safely mark call sites (or unmark attrs of function if we don't know exact size; for C functions with size arg), enabling "NonnullArgPropagation" should not harm. Eli?