From f3c0314310f4c82de6467c4fe4ec4114b9281f04 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Fri, 23 Aug 2013 18:45:06 +0000 Subject: [PATCH] DataFlowSanitizer: correctly combine labels in the case where they are equal. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189133 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Instrumentation/DataFlowSanitizer.cpp | 2 +- test/Instrumentation/DataFlowSanitizer/arith.ll | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp b/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp index 232893dac36..2fa33834f1f 100644 --- a/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp +++ b/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp @@ -775,7 +775,7 @@ Value *DataFlowSanitizer::combineShadows(Value *V1, Value *V2, BasicBlock *Tail = BI->getSuccessor(0); PHINode *Phi = PHINode::Create(ShadowTy, 2, "", Tail->begin()); Phi->addIncoming(Call, Call->getParent()); - Phi->addIncoming(ZeroShadow, Head); + Phi->addIncoming(V1, Head); Pos = Phi; return Phi; } else { diff --git a/test/Instrumentation/DataFlowSanitizer/arith.ll b/test/Instrumentation/DataFlowSanitizer/arith.ll index d75c396e141..dc618963e8b 100644 --- a/test/Instrumentation/DataFlowSanitizer/arith.ll +++ b/test/Instrumentation/DataFlowSanitizer/arith.ll @@ -3,11 +3,12 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3 define i8 @add(i8 %a, i8 %b) { ; CHECK: @"dfs$add" - ; CHECK: load{{.*}}__dfsan_arg_tls - ; CHECK: load{{.*}}__dfsan_arg_tls - ; CHECK: call{{.*}}__dfsan_union + ; CHECK-DAG: %[[ALABEL:.*]] = load{{.*}}__dfsan_arg_tls, i64 0, i64 0 + ; CHECK-DAG: %[[BLABEL:.*]] = load{{.*}}__dfsan_arg_tls, i64 0, i64 1 + ; CHECK: %[[UNION:.*]] = call{{.*}}__dfsan_union(i16 zeroext %[[ALABEL]], i16 zeroext %[[BLABEL]]) + ; CHECK: %[[ADDLABEL:.*]] = phi i16 [ %[[UNION]], {{.*}} ], [ %[[ALABEL]], {{.*}} ] ; CHECK: add i8 - ; CHECK: store{{.*}}__dfsan_retval_tls + ; CHECK: store i16 %[[ADDLABEL]], i16* @__dfsan_retval_tls ; CHECK: ret i8 %c = add i8 %a, %b ret i8 %c -- 2.34.1