[llvm] r212668 - [dfsan] Handle bitcast aliases.
Peter Collingbourne
peter at pcc.me.uk
Wed Jul 9 18:30:39 PDT 2014
Author: pcc
Date: Wed Jul 9 20:30:39 2014
New Revision: 212668
URL: http://llvm.org/viewvc/llvm-project?rev=212668&view=rev
Log:
[dfsan] Handle bitcast aliases.
Modified:
llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
llvm/trunk/test/Instrumentation/DataFlowSanitizer/prefix-rename.ll
Modified: llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp?rev=212668&r1=212667&r2=212668&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp Wed Jul 9 20:30:39 2014
@@ -602,7 +602,7 @@ bool DataFlowSanitizer::runOnModule(Modu
++i;
// Don't stop on weak. We assume people aren't playing games with the
// instrumentedness of overridden weak aliases.
- if (Function *F = dyn_cast<Function>(GA->getAliasee())) {
+ if (auto F = dyn_cast<Function>(GA->getBaseObject())) {
bool GAInst = isInstrumented(GA), FInst = isInstrumented(F);
if (GAInst && FInst) {
addGlobalNamePrefix(GA);
@@ -612,7 +612,7 @@ bool DataFlowSanitizer::runOnModule(Modu
// below will take care of instrumenting it.
Function *NewF =
buildWrapperFunction(F, "", GA->getLinkage(), F->getFunctionType());
- GA->replaceAllUsesWith(NewF);
+ GA->replaceAllUsesWith(ConstantExpr::getBitCast(NewF, GA->getType()));
NewF->takeName(GA);
GA->eraseFromParent();
FnsToInstrument.push_back(NewF);
Modified: llvm/trunk/test/Instrumentation/DataFlowSanitizer/prefix-rename.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/DataFlowSanitizer/prefix-rename.ll?rev=212668&r1=212667&r2=212668&view=diff
==============================================================================
--- llvm/trunk/test/Instrumentation/DataFlowSanitizer/prefix-rename.ll (original)
+++ llvm/trunk/test/Instrumentation/DataFlowSanitizer/prefix-rename.ll Wed Jul 9 20:30:39 2014
@@ -8,7 +8,15 @@ module asm ".symver f1,f@@version1"
; CHECK: @"dfs$f2" = alias {{.*}} @"dfs$f1"
@f2 = alias void ()* @f1
+; CHECK: @"dfs$g2" = alias {{.*}} @"dfs$g1"
+ at g2 = alias bitcast (void (i8*)* @g1 to void (i16*)*)
+
; CHECK: define void @"dfs$f1"
define void @f1() {
ret void
}
+
+; CHECK: define void @"dfs$g1"
+define void @g1(i8*) {
+ ret void
+}
More information about the llvm-commits
mailing list