llvm.org GIT mirror llvm / 706cbb3
[dfsan] Handle bitcast aliases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212668 91177308-0d34-0410-b5e6-96231b3b80d8 Peter Collingbourne 5 years ago
2 changed file(s) with 10 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
601601 ++i;
602602 // Don't stop on weak. We assume people aren't playing games with the
603603 // instrumentedness of overridden weak aliases.
604 if (Function *F = dyn_cast(GA->getAliasee())) {
604 if (auto F = dyn_cast(GA->getBaseObject())) {
605605 bool GAInst = isInstrumented(GA), FInst = isInstrumented(F);
606606 if (GAInst && FInst) {
607607 addGlobalNamePrefix(GA);
611611 // below will take care of instrumenting it.
612612 Function *NewF =
613613 buildWrapperFunction(F, "", GA->getLinkage(), F->getFunctionType());
614 GA->replaceAllUsesWith(NewF);
614 GA->replaceAllUsesWith(ConstantExpr::getBitCast(NewF, GA->getType()));
615615 NewF->takeName(GA);
616616 GA->eraseFromParent();
617617 FnsToInstrument.push_back(NewF);
77 ; CHECK: @"dfs$f2" = alias {{.*}} @"dfs$f1"
88 @f2 = alias void ()* @f1
99
10 ; CHECK: @"dfs$g2" = alias {{.*}} @"dfs$g1"
11 @g2 = alias bitcast (void (i8*)* @g1 to void (i16*)*)
12
1013 ; CHECK: define void @"dfs$f1"
1114 define void @f1() {
1215 ret void
1316 }
17
18 ; CHECK: define void @"dfs$g1"
19 define void @g1(i8*) {
20 ret void
21 }