This is an archive of the discontinued LLVM Phabricator instance.

[LazyCallGraph] Skip blockaddresses
ClosedPublic

Authored by aeubanks on Oct 20 2021, 1:26 PM.

Details

Summary

blockaddresses do not participate in the call graph since the only
instructions that use them must all return to someplace within the
current function. And passes cannot retrieve a function address from a
blockaddress.

This was suggested by efriedma in D58260.

Fixes PR50881.

Diff Detail

Event Timeline

aeubanks created this revision.Oct 20 2021, 1:26 PM
aeubanks requested review of this revision.Oct 20 2021, 1:26 PM
Herald added a reviewer: sstefan1. · View Herald Transcript
Herald added a reviewer: baziotis. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
llvm/lib/Analysis/LazyCallGraph.cpp
1986

I pulled in "llvm/ADT/STLExtras.h" for llvm::all_of in D58260. Can that header now not be included?

llvm/test/Analysis/LazyCallGraph/blockaddress.ll
2

I think you can drop <?

llvm/test/Transforms/Attributor/IPConstantProp/dangling-block-address.ll
37

Can we remove IS__CGSCC_OPM from the RUN lines, too? Looks like this change removes all references? Perhaps we can get rid of the OPM RUN lines? And pre-commit that?

aeubanks added inline comments.Oct 20 2021, 1:55 PM
llvm/lib/Analysis/LazyCallGraph.cpp
1986

there are other instances of all_of in this file

llvm/test/Analysis/LazyCallGraph/blockaddress.ll
2

I think it's generally added to prevent the file name from being leaked to opt, but usually doesn't really matter

llvm/test/Transforms/Attributor/IPConstantProp/dangling-block-address.ll
37

will do

aeubanks added inline comments.Oct 21 2021, 9:06 AM
llvm/test/Transforms/Attributor/IPConstantProp/dangling-block-address.ll
37

apparently it's a bit more complicated than I originally thought: https://reviews.llvm.org/D112184

can we punt on this for now?

nickdesaulniers accepted this revision.Nov 1 2021, 11:00 AM
nickdesaulniers added inline comments.
llvm/test/Transforms/Attributor/IPConstantProp/dangling-block-address.ll
37

Can you remove one run line from one test?

This revision is now accepted and ready to land.Nov 1 2021, 11:00 AM
aeubanks added inline comments.Nov 1 2021, 11:04 AM
llvm/test/Transforms/Attributor/IPConstantProp/dangling-block-address.ll
37

I'd rather keep this consistent with the many other attributor tests which always do this sort of thing.

This revision was automatically updated to reflect the committed changes.