mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-05 13:26:55 +00:00
Correct callgraph construction. It has two problems:
(1) code left over from the days of ConstantPointerRef: if a use of a function is a GlobalValue then that is not considered a reason to add an edge from the external node, even though the use may be as an initializer for an externally visible global! There might be some point to this behaviour when the use is by an alias (though the code predated aliases by some centuries), but I think PR2782 is a better way of handling that. (2) If function F calls function G, and also G is a parameter to the call, then an F->G edge is not added to the callgraph. While this doesn't seem to matter much, adding such an edge makes the callgraph more regular. In addition, the new code should be faster as well as simpler. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55987 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
12
test/Analysis/CallGraph/2008-09-09-DirectCall.ll
Normal file
12
test/Analysis/CallGraph/2008-09-09-DirectCall.ll
Normal file
@@ -0,0 +1,12 @@
|
||||
; RUN: llvm-as < %s | opt -analyze -callgraph -disable-output | grep {Calls function 'callee'} | count 2
|
||||
|
||||
define internal void @callee(...) {
|
||||
entry:
|
||||
unreachable
|
||||
}
|
||||
|
||||
define void @caller() {
|
||||
entry:
|
||||
call void (...)* @callee( void (...)* @callee )
|
||||
unreachable
|
||||
}
|
7
test/Analysis/CallGraph/2008-09-09-UsedByGlobal.ll
Normal file
7
test/Analysis/CallGraph/2008-09-09-UsedByGlobal.ll
Normal file
@@ -0,0 +1,7 @@
|
||||
; RUN: llvm-as < %s | opt -analyze -callgraph -disable-output | grep {Calls function}
|
||||
|
||||
@a = global void ()* @f ; <void ()**> [#uses=0]
|
||||
|
||||
define internal void @f() {
|
||||
unreachable
|
||||
}
|
3
test/Analysis/CallGraph/dg.exp
Normal file
3
test/Analysis/CallGraph/dg.exp
Normal file
@@ -0,0 +1,3 @@
|
||||
load_lib llvm.exp
|
||||
|
||||
RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
|
Reference in New Issue
Block a user