llvm.org GIT mirror llvm / eae2202
Fix rdar://7879828 - crash in CallGraph, a self host issue. Arg promotion was deleting call graph nodes that still had references from the 'indirect' CGN. Like the inliner, it should only delete the function if all references are gone. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101845 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 9 years ago
2 changed file(s) with 47 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
104104 }
105105 Changed |= LocalChange; // Remember that we changed something.
106106 } while (LocalChange);
107
107
108108 return Changed;
109109 }
110110
873873
874874 NF_CGN->stealCalledFunctionsFrom(CG[F]);
875875
876 // Now that the old function is dead, delete it.
877 delete CG.removeFunctionFromModule(F);
876 // Now that the old function is dead, delete it. If there is a dangling
877 // reference to the CallgraphNode, just leave the dead function around for
878 // someone else to nuke.
879 CallGraphNode *CGN = CG[F];
880 if (CGN->getNumReferences() == 0)
881 delete CG.removeFunctionFromModule(CGN);
882 else
883 F->setLinkage(Function::ExternalLinkage);
878884
879885 return NF_CGN;
880886 }
0 ; rdar://7879828
1 ; RUN: opt -inline -argpromotion %s
2 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
3 target triple = "x86_64-apple-darwin10.0.0"
4
5 define void @foo() {
6 invoke void @foo2()
7 to label %if.end432 unwind label %for.end520
8
9 if.end432:
10 unreachable
11
12 for.end520:
13 unreachable
14 }
15
16 define internal void @foo2() ssp {
17 %call7 = call fastcc i8* @foo3(i1 (i8*)* @foo4)
18 %call58 = call fastcc i8* @foo3(i1 (i8*)* @foo5)
19 unreachable
20 }
21
22 define internal fastcc i8* @foo3(i1 (i8*)* %Pred) {
23 entry:
24 unreachable
25 }
26
27 define internal i1 @foo4(i8* %O) nounwind {
28 entry:
29 %call = call zeroext i1 @foo5(i8* %O) ; [#uses=0]
30 unreachable
31 }
32
33 define internal i1 @foo5(i8* %O) nounwind {
34 entry:
35 ret i1 undef
36 }
37