brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 12905c4 Raw
54 lines · plain
1; RUN: opt < %s -passes=dfsan -S | FileCheck %s2target 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@a = common global i32 06@b = common global i32 07 8; Check that we reuse unions where possible.9 10; CHECK-LABEL: @f.dfsan11define void @f(i32 %x, i32 %y) {12  ; CHECK: or i813  %xay = add i32 %x, %y14  store i32 %xay, ptr @a15  ; CHECK-NOT: or i816  %xmy = mul i32 %x, %y17  store i32 %xmy, ptr @b18  ret void19}20 21; In this case, we compute the unions on both sides because neither block22; dominates the other.23 24; CHECK-LABEL: @g.dfsan25define void @g(i1 %p, i32 %x, i32 %y) {26  br i1 %p, label %l1, label %l227 28l1:29  ; CHECK: or i830  %xay = add i32 %x, %y31  store i32 %xay, ptr @a32  br label %l333 34l2:35  ; CHECK: or i836  %xmy = mul i32 %x, %y37  store i32 %xmy, ptr @b38  br label %l339 40l3:41  ret void42}43 44; In this case, we know that the label for %xayax subsumes the label for %xay.45 46; CHECK-LABEL: @h.dfsan47define i32 @h(i32 %x, i32 %y) {48  ; CHECK: or i849  %xay = add i32 %x, %y50  ; CHECK-NOT: or i851  %xayax = add i32 %xay, %x52  ret i32 %xayax53}54