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.
Details
Diff Detail
- Repository
- rL LLVM
- Build Status
Buildable 37461 Build 37460: arc lint + arc unit
Event Timeline
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}
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.