1; RUN: opt < %s -dfsan -S | FileCheck %s 2target 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-S128" 3target triple = "x86_64-unknown-linux-gnu" 4 5; CHECK: @__dfsan_shadow_width_bits = weak_odr constant i32 [[#SBITS:]] 6; CHECK: @__dfsan_shadow_width_bytes = weak_odr constant i32 [[#SBYTES:]] 7 8@a = common global i32 0 9@b = common global i32 0 10 11; Check that we reuse unions where possible. 12 13; CHECK-LABEL: @f.dfsan 14define void @f(i32 %x, i32 %y) { 15 ; CHECK: or i[[#SBITS]] 16 %xay = add i32 %x, %y 17 store i32 %xay, i32* @a 18 ; CHECK-NOT: or i[[#SBITS]] 19 %xmy = mul i32 %x, %y 20 store i32 %xmy, i32* @b 21 ret void 22} 23 24; In this case, we compute the unions on both sides because neither block 25; dominates the other. 26 27; CHECK-LABEL: @g.dfsan 28define void @g(i1 %p, i32 %x, i32 %y) { 29 br i1 %p, label %l1, label %l2 30 31l1: 32 ; CHECK: or i[[#SBITS]] 33 %xay = add i32 %x, %y 34 store i32 %xay, i32* @a 35 br label %l3 36 37l2: 38 ; CHECK: or i[[#SBITS]] 39 %xmy = mul i32 %x, %y 40 store i32 %xmy, i32* @b 41 br label %l3 42 43l3: 44 ret void 45} 46 47; In this case, we know that the label for %xayax subsumes the label for %xay. 48 49; CHECK-LABEL: @h.dfsan 50define i32 @h(i32 %x, i32 %y) { 51 ; CHECK: or i[[#SBITS]] 52 %xay = add i32 %x, %y 53 ; CHECK-NOT: or i[[#SBITS]] 54 %xayax = add i32 %xay, %x 55 ret i32 %xayax 56} 57