This is an archive of the discontinued LLVM Phabricator instance.

[GVN] Disallow phi translation for expressions with calls.
AbandonedPublic

Authored by asbirlea on Aug 28 2019, 3:19 PM.

Details

Reviewers
wmi
resistor
Summary

Phi translation for expressions with calls may lead to miscompiles in the absence of additional checks for memory interfering instructions.
See PR42605, for additional details.
Resolves PR42605.

Diff Detail

Event Timeline

asbirlea created this revision.Aug 28 2019, 3:19 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 28 2019, 3:19 PM
lkail added a subscriber: lkail.Aug 28 2019, 8:03 PM
wmi added a comment.Aug 29 2019, 1:43 PM

Thanks Alina to analyze the problem and write the fix.

I agree with your analysis and I believe the patch could fix the problem. But I am little worried the blunt hammer fix could pontentially hurt performance. Maybe we can use MD to do a finegrain check? I draft a fix attached. Please take a look whether it is correct and free to change it. {F9879631}

wmi added a comment.Aug 29 2019, 1:48 PM
In D66909#1651640, @wmi wrote:

Thanks Alina to analyze the problem and write the fix.

I agree with your analysis and I believe the patch could fix the problem. But I am little worried the blunt hammer fix could pontentially hurt performance. Maybe we can use MD to do a finegrain check? I draft a fix attached. Please take a look whether it is correct and free to change it. {F9879631}

The previous patch uploaded is somehow not intact. Upload it another time:

Thanks Wei, I think the patch you sent looks like a good path forward. I'd have a few comments on it.
Do you want to send it for review and pick up the test from this patch? I'll be happy to review it.

wmi added a comment.Aug 30 2019, 10:49 AM

Thanks Wei, I think the patch you sent looks like a good path forward. I'd have a few comments on it.
Do you want to send it for review and pick up the test from this patch? I'll be happy to review it.

Thanks Alina. Send https://reviews.llvm.org/D67013 for review. I found MemDepResult with 'Def' DefType won't give us the collection of calls we want. It will give us the collection of identical calls without clobber between them and the current call, however, the identical criteria is too strict to accommodate phi-translate case.

So currently D67013 only does phitranslate for the call instruction with NonFuncLocal type MemDepResult, i.e., no clobber instruction in current function, and it is still conservative.

asbirlea abandoned this revision.Aug 30 2019, 3:06 PM