This is an archive of the discontinued LLVM Phabricator instance.

Preserve GlobalsAA analysis result in LowerConstantIntrinsics and InjectTLIMappings
AbandonedPublic

Authored by rsanthir.quic on Jun 17 2020, 4:51 PM.

Details

Summary

Both LowerConstantIntrinsics and InjectTLIMappings fail to preserve the analysis result of GlobalsAA. Not preserving the analysis might affect benchmark performance. This change fixes this issue.

Diff Detail

Event Timeline

rsanthir.quic created this revision.Jun 17 2020, 4:51 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 17 2020, 4:51 PM

Ran clang-format to update the patch

fpetrogalli added inline comments.Jun 19 2020, 8:27 AM
llvm/lib/Transforms/Utils/InjectTLIMappings.cpp
148

Hi @rsanthir.quic

Thank you for your patch.

Didn't you have to add this pass to the tests checking the pass sequence? Have you run make check-all on your changes?

Francesco

fhahn accepted this revision.Jun 19 2020, 9:22 AM
fhahn added a reviewer: fhahn.
fhahn added a subscriber: fhahn.

LGTM. Neither InjectTLIMappings nor LowerConstantIntrinsics should modify globals and can preserve GlobalsAA. This is also in line with what we currently do in many other passes.

llvm/lib/Transforms/Scalar/LowerConstantIntrinsics.cpp
141

hmm, there's probably potential for preserving more here. But that's for potential follow-ups.

llvm/lib/Transforms/Utils/InjectTLIMappings.cpp
148

AFAIK if GlobalsAA is only used if it is available. So if it is not preserved, it won't be re-built, so this change won't impact any of the pipeline tests.

This revision is now accepted and ready to land.Jun 19 2020, 9:22 AM
fhahn added a comment.Jun 19 2020, 9:30 AM

It might be good to commit both patches separately.

rsanthir.quic marked an inline comment as done.Jun 22 2020, 1:16 PM

I can definitely split this into two different patches

llvm/lib/Transforms/Utils/InjectTLIMappings.cpp
148

Thanks for the explanation @fhahn, I did run make check-all as well, and I didnt notice any issues anyway @fpetrogalli

fpetrogalli accepted this revision.Jun 22 2020, 1:56 PM
fpetrogalli added inline comments.
llvm/lib/Transforms/Utils/InjectTLIMappings.cpp
148

Thank you for confirming, LGTM.

Francesco