Home | History | Annotate | Download | only in HWAddressSanitizer
      1 ; Test alloca instrumentation when tags are generated by HWASan function.
      2 ;
      3 ; RUN: opt < %s -hwasan -hwasan-generate-tags-with-calls -S | FileCheck %s
      4 
      5 target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
      6 target triple = "aarch64--linux-android"
      7 
      8 declare void @use32(i32*)
      9 
     10 define void @test_alloca() sanitize_hwaddress {
     11 ; CHECK-LABEL: @test_alloca(
     12 ; CHECK: %[[T1:[^ ]*]] = call i8 @__hwasan_generate_tag()
     13 ; CHECK: %[[A:[^ ]*]] = zext i8 %[[T1]] to i64
     14 ; CHECK: %[[B:[^ ]*]] = ptrtoint i32* %x to i64
     15 ; CHECK: %[[C:[^ ]*]] = shl i64 %[[A]], 56
     16 ; CHECK: or i64 %[[B]], %[[C]]
     17 
     18 entry:
     19   %x = alloca i32, align 4
     20   call void @use32(i32* nonnull %x)
     21   ret void
     22 }
     23