2014-04-26 06:23:54 +08:00
|
|
|
; RUN: llc -filetype=obj -mtriple=x86_64-pc-linux-gnu %s -o %t
|
|
|
|
; RUN: llvm-readobj --relocations %t | FileCheck %s
|
|
|
|
|
|
|
|
; Check that we don't have any relocations in the ranges section -
|
|
|
|
; to show that we're producing this as a relative offset to the
|
|
|
|
; low_pc for the compile unit.
|
|
|
|
; CHECK-NOT: .rela.debug_ranges
|
|
|
|
|
|
|
|
@llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 0, void ()* @__msan_init }]
|
|
|
|
@str = private unnamed_addr constant [4 x i8] c"zzz\00"
|
|
|
|
@__msan_retval_tls = external thread_local(initialexec) global [8 x i64]
|
|
|
|
@__msan_retval_origin_tls = external thread_local(initialexec) global i32
|
|
|
|
@__msan_param_tls = external thread_local(initialexec) global [1000 x i64]
|
|
|
|
@__msan_param_origin_tls = external thread_local(initialexec) global [1000 x i32]
|
|
|
|
@__msan_va_arg_tls = external thread_local(initialexec) global [1000 x i64]
|
|
|
|
@__msan_va_arg_overflow_size_tls = external thread_local(initialexec) global i64
|
|
|
|
@__msan_origin_tls = external thread_local(initialexec) global i32
|
|
|
|
@__executable_start = external hidden global i32
|
|
|
|
@_end = external hidden global i32
|
|
|
|
|
|
|
|
; Function Attrs: sanitize_memory uwtable
|
2015-11-06 06:03:56 +08:00
|
|
|
define void @_Z1fv() #0 !dbg !4 {
|
2014-04-26 06:23:54 +08:00
|
|
|
entry:
|
|
|
|
%p = alloca i32*, align 8
|
|
|
|
%0 = ptrtoint i32** %p to i64, !dbg !19
|
|
|
|
%1 = and i64 %0, -70368744177672, !dbg !19
|
|
|
|
%2 = inttoptr i64 %1 to i64*, !dbg !19
|
|
|
|
store i64 -1, i64* %2, align 8, !dbg !19
|
2015-03-14 02:20:45 +08:00
|
|
|
store i64 0, i64* getelementptr inbounds ([1000 x i64], [1000 x i64]* @__msan_param_tls, i64 0, i64 0), align 8, !dbg !19
|
|
|
|
store i64 0, i64* getelementptr inbounds ([8 x i64], [8 x i64]* @__msan_retval_tls, i64 0, i64 0), align 8, !dbg !19
|
2014-04-26 06:23:54 +08:00
|
|
|
%call = call i8* @_Znwm(i64 4) #4, !dbg !19
|
2015-03-14 02:20:45 +08:00
|
|
|
%_msret = load i64, i64* getelementptr inbounds ([8 x i64], [8 x i64]* @__msan_retval_tls, i64 0, i64 0), align 8, !dbg !19
|
2014-04-26 06:23:54 +08:00
|
|
|
%3 = bitcast i8* %call to i32*, !dbg !19
|
2017-07-29 04:21:02 +08:00
|
|
|
tail call void @llvm.dbg.value(metadata i32* %3, metadata !9, metadata !DIExpression()), !dbg !19
|
2014-04-26 06:23:54 +08:00
|
|
|
%4 = inttoptr i64 %1 to i64*, !dbg !19
|
|
|
|
store i64 %_msret, i64* %4, align 8, !dbg !19
|
|
|
|
store volatile i32* %3, i32** %p, align 8, !dbg !19
|
2017-07-29 04:21:02 +08:00
|
|
|
tail call void @llvm.dbg.value(metadata i32** %p, metadata !9, metadata !DIExpression()), !dbg !19
|
2015-02-28 05:17:42 +08:00
|
|
|
%p.0.p.0. = load volatile i32*, i32** %p, align 8, !dbg !20
|
|
|
|
%_msld = load i64, i64* %4, align 8, !dbg !20
|
2014-04-26 06:23:54 +08:00
|
|
|
%_mscmp = icmp eq i64 %_msld, 0, !dbg !20
|
|
|
|
br i1 %_mscmp, label %6, label %5, !dbg !20, !prof !22
|
|
|
|
|
|
|
|
; <label>:5 ; preds = %entry
|
|
|
|
call void @__msan_warning_noreturn(), !dbg !20
|
|
|
|
call void asm sideeffect "", ""() #3, !dbg !20
|
|
|
|
unreachable, !dbg !20
|
|
|
|
|
|
|
|
; <label>:6 ; preds = %entry
|
2015-02-28 05:17:42 +08:00
|
|
|
%7 = load i32, i32* %p.0.p.0., align 4, !dbg !20, !tbaa !23
|
2014-04-26 06:23:54 +08:00
|
|
|
%8 = ptrtoint i32* %p.0.p.0. to i64, !dbg !20
|
|
|
|
%9 = and i64 %8, -70368744177665, !dbg !20
|
|
|
|
%10 = inttoptr i64 %9 to i32*, !dbg !20
|
2015-02-28 05:17:42 +08:00
|
|
|
%_msld2 = load i32, i32* %10, align 4, !dbg !20
|
2014-04-26 06:23:54 +08:00
|
|
|
%11 = icmp ne i32 %_msld2, 0, !dbg !20
|
|
|
|
%12 = xor i32 %_msld2, -1, !dbg !20
|
|
|
|
%13 = and i32 %7, %12, !dbg !20
|
|
|
|
%14 = icmp eq i32 %13, 0, !dbg !20
|
|
|
|
%_msprop_icmp = and i1 %11, %14, !dbg !20
|
|
|
|
br i1 %_msprop_icmp, label %15, label %16, !dbg !20, !prof !27
|
|
|
|
|
|
|
|
; <label>:15 ; preds = %6
|
|
|
|
call void @__msan_warning_noreturn(), !dbg !20
|
|
|
|
call void asm sideeffect "", ""() #3, !dbg !20
|
|
|
|
unreachable, !dbg !20
|
|
|
|
|
|
|
|
; <label>:16 ; preds = %6
|
|
|
|
%tobool = icmp eq i32 %7, 0, !dbg !20
|
|
|
|
br i1 %tobool, label %if.end, label %if.then, !dbg !20
|
|
|
|
|
|
|
|
if.then: ; preds = %16
|
2015-03-14 02:20:45 +08:00
|
|
|
store i64 0, i64* getelementptr inbounds ([1000 x i64], [1000 x i64]* @__msan_param_tls, i64 0, i64 0), align 8, !dbg !28
|
2014-04-26 06:23:54 +08:00
|
|
|
store i32 0, i32* bitcast ([8 x i64]* @__msan_retval_tls to i32*), align 8, !dbg !28
|
2015-03-14 02:20:45 +08:00
|
|
|
%puts = call i32 @puts(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0)), !dbg !28
|
2014-04-26 06:23:54 +08:00
|
|
|
br label %if.end, !dbg !28
|
|
|
|
|
|
|
|
if.end: ; preds = %16, %if.then
|
|
|
|
ret void, !dbg !29
|
|
|
|
}
|
|
|
|
|
|
|
|
; Function Attrs: nobuiltin
|
|
|
|
declare i8* @_Znwm(i64) #1
|
|
|
|
|
|
|
|
; Function Attrs: sanitize_memory uwtable
|
2015-11-06 06:03:56 +08:00
|
|
|
define i32 @main() #0 !dbg !13 {
|
2014-04-26 06:23:54 +08:00
|
|
|
entry:
|
|
|
|
%p.i = alloca i32*, align 8
|
|
|
|
%0 = ptrtoint i32** %p.i to i64, !dbg !30
|
|
|
|
%1 = and i64 %0, -70368744177672, !dbg !30
|
|
|
|
%2 = inttoptr i64 %1 to i64*, !dbg !30
|
|
|
|
store i64 -1, i64* %2, align 8, !dbg !30
|
|
|
|
%p.i.0..sroa_cast = bitcast i32** %p.i to i8*, !dbg !30
|
|
|
|
call void @llvm.lifetime.start(i64 8, i8* %p.i.0..sroa_cast), !dbg !30
|
2015-03-14 02:20:45 +08:00
|
|
|
store i64 0, i64* getelementptr inbounds ([1000 x i64], [1000 x i64]* @__msan_param_tls, i64 0, i64 0), align 8, !dbg !30
|
|
|
|
store i64 0, i64* getelementptr inbounds ([8 x i64], [8 x i64]* @__msan_retval_tls, i64 0, i64 0), align 8, !dbg !30
|
2014-04-26 06:23:54 +08:00
|
|
|
%call.i = call i8* @_Znwm(i64 4) #4, !dbg !30
|
2015-03-14 02:20:45 +08:00
|
|
|
%_msret = load i64, i64* getelementptr inbounds ([8 x i64], [8 x i64]* @__msan_retval_tls, i64 0, i64 0), align 8, !dbg !30
|
2014-04-26 06:23:54 +08:00
|
|
|
%3 = bitcast i8* %call.i to i32*, !dbg !30
|
2017-07-29 04:21:02 +08:00
|
|
|
tail call void @llvm.dbg.value(metadata i32* %3, metadata !32, metadata !DIExpression()), !dbg !30
|
2014-04-26 06:23:54 +08:00
|
|
|
%4 = inttoptr i64 %1 to i64*, !dbg !30
|
|
|
|
store i64 %_msret, i64* %4, align 8, !dbg !30
|
|
|
|
store volatile i32* %3, i32** %p.i, align 8, !dbg !30
|
2017-07-29 04:21:02 +08:00
|
|
|
tail call void @llvm.dbg.value(metadata i32** %p.i, metadata !32, metadata !DIExpression()), !dbg !30
|
2015-02-28 05:17:42 +08:00
|
|
|
%p.i.0.p.0.p.0..i = load volatile i32*, i32** %p.i, align 8, !dbg !33
|
|
|
|
%_msld = load i64, i64* %4, align 8, !dbg !33
|
2014-04-26 06:23:54 +08:00
|
|
|
%_mscmp = icmp eq i64 %_msld, 0, !dbg !33
|
|
|
|
br i1 %_mscmp, label %6, label %5, !dbg !33, !prof !22
|
|
|
|
|
|
|
|
; <label>:5 ; preds = %entry
|
|
|
|
call void @__msan_warning_noreturn(), !dbg !33
|
|
|
|
call void asm sideeffect "", ""() #3, !dbg !33
|
|
|
|
unreachable, !dbg !33
|
|
|
|
|
|
|
|
; <label>:6 ; preds = %entry
|
2015-02-28 05:17:42 +08:00
|
|
|
%7 = load i32, i32* %p.i.0.p.0.p.0..i, align 4, !dbg !33, !tbaa !23
|
2014-04-26 06:23:54 +08:00
|
|
|
%8 = ptrtoint i32* %p.i.0.p.0.p.0..i to i64, !dbg !33
|
|
|
|
%9 = and i64 %8, -70368744177665, !dbg !33
|
|
|
|
%10 = inttoptr i64 %9 to i32*, !dbg !33
|
2015-02-28 05:17:42 +08:00
|
|
|
%_msld2 = load i32, i32* %10, align 4, !dbg !33
|
2014-04-26 06:23:54 +08:00
|
|
|
%11 = icmp ne i32 %_msld2, 0, !dbg !33
|
|
|
|
%12 = xor i32 %_msld2, -1, !dbg !33
|
|
|
|
%13 = and i32 %7, %12, !dbg !33
|
|
|
|
%14 = icmp eq i32 %13, 0, !dbg !33
|
|
|
|
%_msprop_icmp = and i1 %11, %14, !dbg !33
|
|
|
|
br i1 %_msprop_icmp, label %15, label %16, !dbg !33, !prof !27
|
|
|
|
|
|
|
|
; <label>:15 ; preds = %6
|
|
|
|
call void @__msan_warning_noreturn(), !dbg !33
|
|
|
|
call void asm sideeffect "", ""() #3, !dbg !33
|
|
|
|
unreachable, !dbg !33
|
|
|
|
|
|
|
|
; <label>:16 ; preds = %6
|
|
|
|
%tobool.i = icmp eq i32 %7, 0, !dbg !33
|
|
|
|
br i1 %tobool.i, label %_Z1fv.exit, label %if.then.i, !dbg !33
|
|
|
|
|
|
|
|
if.then.i: ; preds = %16
|
2015-03-14 02:20:45 +08:00
|
|
|
store i64 0, i64* getelementptr inbounds ([1000 x i64], [1000 x i64]* @__msan_param_tls, i64 0, i64 0), align 8, !dbg !34
|
2014-04-26 06:23:54 +08:00
|
|
|
store i32 0, i32* bitcast ([8 x i64]* @__msan_retval_tls to i32*), align 8, !dbg !34
|
2015-03-14 02:20:45 +08:00
|
|
|
%puts.i = call i32 @puts(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0)), !dbg !34
|
2014-04-26 06:23:54 +08:00
|
|
|
br label %_Z1fv.exit, !dbg !34
|
|
|
|
|
|
|
|
_Z1fv.exit: ; preds = %16, %if.then.i
|
|
|
|
call void @llvm.lifetime.end(i64 8, i8* %p.i.0..sroa_cast), !dbg !35
|
|
|
|
store i32 0, i32* bitcast ([8 x i64]* @__msan_retval_tls to i32*), align 8, !dbg !36
|
|
|
|
ret i32 0, !dbg !36
|
|
|
|
}
|
|
|
|
|
|
|
|
declare void @__msan_init()
|
|
|
|
|
|
|
|
; Function Attrs: nounwind readnone
|
2017-07-29 04:21:02 +08:00
|
|
|
declare void @llvm.dbg.value(metadata, metadata, metadata) #2
|
2014-04-26 06:23:54 +08:00
|
|
|
|
|
|
|
; Function Attrs: nounwind
|
|
|
|
declare i32 @puts(i8* nocapture readonly) #3
|
|
|
|
|
|
|
|
; Function Attrs: nounwind
|
|
|
|
declare void @llvm.lifetime.start(i64, i8* nocapture) #3
|
|
|
|
|
|
|
|
; Function Attrs: nounwind
|
|
|
|
declare void @llvm.lifetime.end(i64, i8* nocapture) #3
|
|
|
|
|
|
|
|
declare void @__msan_warning_noreturn()
|
|
|
|
|
|
|
|
declare void @__msan_maybe_warning_1(i8, i32)
|
|
|
|
|
|
|
|
declare void @__msan_maybe_store_origin_1(i8, i8*, i32)
|
|
|
|
|
|
|
|
declare void @__msan_maybe_warning_2(i16, i32)
|
|
|
|
|
|
|
|
declare void @__msan_maybe_store_origin_2(i16, i8*, i32)
|
|
|
|
|
|
|
|
declare void @__msan_maybe_warning_4(i32, i32)
|
|
|
|
|
|
|
|
declare void @__msan_maybe_store_origin_4(i32, i8*, i32)
|
|
|
|
|
|
|
|
declare void @__msan_maybe_warning_8(i64, i32)
|
|
|
|
|
|
|
|
declare void @__msan_maybe_store_origin_8(i64, i8*, i32)
|
|
|
|
|
|
|
|
declare void @__msan_set_alloca_origin4(i8*, i64, i8*, i64)
|
|
|
|
|
|
|
|
declare void @__msan_poison_stack(i8*, i64)
|
|
|
|
|
|
|
|
declare i32 @__msan_chain_origin(i32)
|
|
|
|
|
|
|
|
declare i8* @__msan_memmove(i8*, i8*, i64)
|
|
|
|
|
|
|
|
declare i8* @__msan_memcpy(i8*, i8*, i64)
|
|
|
|
|
|
|
|
declare i8* @__msan_memset(i8*, i32, i64)
|
|
|
|
|
|
|
|
; Function Attrs: nounwind
|
Remove alignment argument from memcpy/memmove/memset in favour of alignment attributes (Step 1)
Summary:
This is a resurrection of work first proposed and discussed in Aug 2015:
http://lists.llvm.org/pipermail/llvm-dev/2015-August/089384.html
and initially landed (but then backed out) in Nov 2015:
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151109/312083.html
The @llvm.memcpy/memmove/memset intrinsics currently have an explicit argument
which is required to be a constant integer. It represents the alignment of the
dest (and source), and so must be the minimum of the actual alignment of the
two.
This change is the first in a series that allows source and dest to each
have their own alignments by using the alignment attribute on their arguments.
In this change we:
1) Remove the alignment argument.
2) Add alignment attributes to the source & dest arguments. We, temporarily,
require that the alignments for source & dest be equal.
For example, code which used to read:
call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* %src, i32 100, i32 4, i1 false)
will now read
call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %dest, i8* align 4 %src, i32 100, i1 false)
Downstream users may have to update their lit tests that check for
@llvm.memcpy/memmove/memset call/declaration patterns. The following extended sed script
may help with updating the majority of your tests, but it does not catch all possible
patterns so some manual checking and updating will be required.
s~declare void @llvm\.mem(set|cpy|move)\.p([^(]*)\((.*), i32, i1\)~declare void @llvm.mem\1.p\2(\3, i1)~g
s~call void @llvm\.memset\.p([^(]*)i8\(i8([^*]*)\* (.*), i8 (.*), i8 (.*), i32 [01], i1 ([^)]*)\)~call void @llvm.memset.p\1i8(i8\2* \3, i8 \4, i8 \5, i1 \6)~g
s~call void @llvm\.memset\.p([^(]*)i16\(i8([^*]*)\* (.*), i8 (.*), i16 (.*), i32 [01], i1 ([^)]*)\)~call void @llvm.memset.p\1i16(i8\2* \3, i8 \4, i16 \5, i1 \6)~g
s~call void @llvm\.memset\.p([^(]*)i32\(i8([^*]*)\* (.*), i8 (.*), i32 (.*), i32 [01], i1 ([^)]*)\)~call void @llvm.memset.p\1i32(i8\2* \3, i8 \4, i32 \5, i1 \6)~g
s~call void @llvm\.memset\.p([^(]*)i64\(i8([^*]*)\* (.*), i8 (.*), i64 (.*), i32 [01], i1 ([^)]*)\)~call void @llvm.memset.p\1i64(i8\2* \3, i8 \4, i64 \5, i1 \6)~g
s~call void @llvm\.memset\.p([^(]*)i128\(i8([^*]*)\* (.*), i8 (.*), i128 (.*), i32 [01], i1 ([^)]*)\)~call void @llvm.memset.p\1i128(i8\2* \3, i8 \4, i128 \5, i1 \6)~g
s~call void @llvm\.memset\.p([^(]*)i8\(i8([^*]*)\* (.*), i8 (.*), i8 (.*), i32 ([0-9]*), i1 ([^)]*)\)~call void @llvm.memset.p\1i8(i8\2* align \6 \3, i8 \4, i8 \5, i1 \7)~g
s~call void @llvm\.memset\.p([^(]*)i16\(i8([^*]*)\* (.*), i8 (.*), i16 (.*), i32 ([0-9]*), i1 ([^)]*)\)~call void @llvm.memset.p\1i16(i8\2* align \6 \3, i8 \4, i16 \5, i1 \7)~g
s~call void @llvm\.memset\.p([^(]*)i32\(i8([^*]*)\* (.*), i8 (.*), i32 (.*), i32 ([0-9]*), i1 ([^)]*)\)~call void @llvm.memset.p\1i32(i8\2* align \6 \3, i8 \4, i32 \5, i1 \7)~g
s~call void @llvm\.memset\.p([^(]*)i64\(i8([^*]*)\* (.*), i8 (.*), i64 (.*), i32 ([0-9]*), i1 ([^)]*)\)~call void @llvm.memset.p\1i64(i8\2* align \6 \3, i8 \4, i64 \5, i1 \7)~g
s~call void @llvm\.memset\.p([^(]*)i128\(i8([^*]*)\* (.*), i8 (.*), i128 (.*), i32 ([0-9]*), i1 ([^)]*)\)~call void @llvm.memset.p\1i128(i8\2* align \6 \3, i8 \4, i128 \5, i1 \7)~g
s~call void @llvm\.mem(cpy|move)\.p([^(]*)i8\(i8([^*]*)\* (.*), i8([^*]*)\* (.*), i8 (.*), i32 [01], i1 ([^)]*)\)~call void @llvm.mem\1.p\2i8(i8\3* \4, i8\5* \6, i8 \7, i1 \8)~g
s~call void @llvm\.mem(cpy|move)\.p([^(]*)i16\(i8([^*]*)\* (.*), i8([^*]*)\* (.*), i16 (.*), i32 [01], i1 ([^)]*)\)~call void @llvm.mem\1.p\2i16(i8\3* \4, i8\5* \6, i16 \7, i1 \8)~g
s~call void @llvm\.mem(cpy|move)\.p([^(]*)i32\(i8([^*]*)\* (.*), i8([^*]*)\* (.*), i32 (.*), i32 [01], i1 ([^)]*)\)~call void @llvm.mem\1.p\2i32(i8\3* \4, i8\5* \6, i32 \7, i1 \8)~g
s~call void @llvm\.mem(cpy|move)\.p([^(]*)i64\(i8([^*]*)\* (.*), i8([^*]*)\* (.*), i64 (.*), i32 [01], i1 ([^)]*)\)~call void @llvm.mem\1.p\2i64(i8\3* \4, i8\5* \6, i64 \7, i1 \8)~g
s~call void @llvm\.mem(cpy|move)\.p([^(]*)i128\(i8([^*]*)\* (.*), i8([^*]*)\* (.*), i128 (.*), i32 [01], i1 ([^)]*)\)~call void @llvm.mem\1.p\2i128(i8\3* \4, i8\5* \6, i128 \7, i1 \8)~g
s~call void @llvm\.mem(cpy|move)\.p([^(]*)i8\(i8([^*]*)\* (.*), i8([^*]*)\* (.*), i8 (.*), i32 ([0-9]*), i1 ([^)]*)\)~call void @llvm.mem\1.p\2i8(i8\3* align \8 \4, i8\5* align \8 \6, i8 \7, i1 \9)~g
s~call void @llvm\.mem(cpy|move)\.p([^(]*)i16\(i8([^*]*)\* (.*), i8([^*]*)\* (.*), i16 (.*), i32 ([0-9]*), i1 ([^)]*)\)~call void @llvm.mem\1.p\2i16(i8\3* align \8 \4, i8\5* align \8 \6, i16 \7, i1 \9)~g
s~call void @llvm\.mem(cpy|move)\.p([^(]*)i32\(i8([^*]*)\* (.*), i8([^*]*)\* (.*), i32 (.*), i32 ([0-9]*), i1 ([^)]*)\)~call void @llvm.mem\1.p\2i32(i8\3* align \8 \4, i8\5* align \8 \6, i32 \7, i1 \9)~g
s~call void @llvm\.mem(cpy|move)\.p([^(]*)i64\(i8([^*]*)\* (.*), i8([^*]*)\* (.*), i64 (.*), i32 ([0-9]*), i1 ([^)]*)\)~call void @llvm.mem\1.p\2i64(i8\3* align \8 \4, i8\5* align \8 \6, i64 \7, i1 \9)~g
s~call void @llvm\.mem(cpy|move)\.p([^(]*)i128\(i8([^*]*)\* (.*), i8([^*]*)\* (.*), i128 (.*), i32 ([0-9]*), i1 ([^)]*)\)~call void @llvm.mem\1.p\2i128(i8\3* align \8 \4, i8\5* align \8 \6, i128 \7, i1 \9)~g
The remaining changes in the series will:
Step 2) Expand the IRBuilder API to allow creation of memcpy/memmove with differing
source and dest alignments.
Step 3) Update Clang to use the new IRBuilder API.
Step 4) Update Polly to use the new IRBuilder API.
Step 5) Update LLVM passes that create memcpy/memmove calls to use the new IRBuilder API,
and those that use use MemIntrinsicInst::[get|set]Alignment() to use
getDestAlignment() and getSourceAlignment() instead.
Step 6) Remove the single-alignment IRBuilder API for memcpy/memmove, and the
MemIntrinsicInst::[get|set]Alignment() methods.
Reviewers: pete, hfinkel, lhames, reames, bollu
Reviewed By: reames
Subscribers: niosHD, reames, jholewinski, qcolombet, jfb, sanjoy, arsenm, dschuff, dylanmckay, mehdi_amini, sdardis, nemanjai, david2050, nhaehnle, javed.absar, sbc100, jgravelle-google, eraman, aheejin, kbarton, JDevlieghere, asb, rbar, johnrusso, simoncook, jordy.potman.lists, apazos, sabuasal, llvm-commits
Differential Revision: https://reviews.llvm.org/D41675
llvm-svn: 322965
2018-01-20 01:13:12 +08:00
|
|
|
declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i1) #3
|
2014-04-26 06:23:54 +08:00
|
|
|
|
|
|
|
attributes #0 = { sanitize_memory uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
|
|
|
attributes #1 = { nobuiltin "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
|
|
|
attributes #2 = { nounwind readnone }
|
|
|
|
attributes #3 = { nounwind }
|
|
|
|
attributes #4 = { builtin }
|
|
|
|
|
|
|
|
!llvm.dbg.cu = !{!0}
|
|
|
|
!llvm.module.flags = !{!16, !17}
|
|
|
|
!llvm.ident = !{!18}
|
|
|
|
|
2016-04-15 23:57:41 +08:00
|
|
|
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 (trunk 207243) (llvm/trunk 207259)", isOptimized: true, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
|
2015-04-30 00:38:44 +08:00
|
|
|
!1 = !DIFile(filename: "foo.cpp", directory: "/usr/local/google/home/echristo/tmp")
|
IR: Make metadata typeless in assembly
Now that `Metadata` is typeless, reflect that in the assembly. These
are the matching assembly changes for the metadata/value split in
r223802.
- Only use the `metadata` type when referencing metadata from a call
intrinsic -- i.e., only when it's used as a `Value`.
- Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode`
when referencing it from call intrinsics.
So, assembly like this:
define @foo(i32 %v) {
call void @llvm.foo(metadata !{i32 %v}, metadata !0)
call void @llvm.foo(metadata !{i32 7}, metadata !0)
call void @llvm.foo(metadata !1, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{metadata !3}, metadata !0)
ret void, !bar !2
}
!0 = metadata !{metadata !2}
!1 = metadata !{i32* @global}
!2 = metadata !{metadata !3}
!3 = metadata !{}
turns into this:
define @foo(i32 %v) {
call void @llvm.foo(metadata i32 %v, metadata !0)
call void @llvm.foo(metadata i32 7, metadata !0)
call void @llvm.foo(metadata i32* @global, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{!3}, metadata !0)
ret void, !bar !2
}
!0 = !{!2}
!1 = !{i32* @global}
!2 = !{!3}
!3 = !{}
I wrote an upgrade script that handled almost all of the tests in llvm
and many of the tests in cfe (even handling many `CHECK` lines). I've
attached it (or will attach it in a moment if you're speedy) to PR21532
to help everyone update their out-of-tree testcases.
This is part of PR21532.
llvm-svn: 224257
2014-12-16 03:07:53 +08:00
|
|
|
!2 = !{}
|
[DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label.
In order to set breakpoints on labels and list source code around
labels, we need collect debug information for labels, i.e., label
name, the function label belong, line number in the file, and the
address label located. In order to keep these information in LLVM
IR and to allow backend to generate debug information correctly.
We create a new kind of metadata for labels, DILabel. The format
of DILabel is
!DILabel(scope: !1, name: "foo", file: !2, line: 3)
We hope to keep debug information as much as possible even the
code is optimized. So, we create a new kind of intrinsic for label
metadata to avoid the metadata is eliminated with basic block.
The intrinsic will keep existing if we keep it from optimized out.
The format of the intrinsic is
llvm.dbg.label(metadata !1)
It has only one argument, that is the DILabel metadata. The
intrinsic will follow the label immediately. Backend could get the
label metadata through the intrinsic's parameter.
We also create DIBuilder API for labels to be used by Frontend.
Frontend could use createLabel() to allocate DILabel objects, and use
insertLabel() to insert llvm.dbg.label intrinsic in LLVM IR.
Differential Revision: https://reviews.llvm.org/D45024
Patch by Hsiangkai Wang.
llvm-svn: 331841
2018-05-09 10:40:45 +08:00
|
|
|
!4 = distinct !DISubprogram(name: "f", linkageName: "_Z1fv", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 3, file: !1, scope: !5, type: !6, retainedNodes: !8)
|
2015-04-30 00:38:44 +08:00
|
|
|
!5 = !DIFile(filename: "foo.cpp", directory: "/usr/local/google/home/echristo/tmp")
|
|
|
|
!6 = !DISubroutineType(types: !7)
|
IR: Make metadata typeless in assembly
Now that `Metadata` is typeless, reflect that in the assembly. These
are the matching assembly changes for the metadata/value split in
r223802.
- Only use the `metadata` type when referencing metadata from a call
intrinsic -- i.e., only when it's used as a `Value`.
- Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode`
when referencing it from call intrinsics.
So, assembly like this:
define @foo(i32 %v) {
call void @llvm.foo(metadata !{i32 %v}, metadata !0)
call void @llvm.foo(metadata !{i32 7}, metadata !0)
call void @llvm.foo(metadata !1, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{metadata !3}, metadata !0)
ret void, !bar !2
}
!0 = metadata !{metadata !2}
!1 = metadata !{i32* @global}
!2 = metadata !{metadata !3}
!3 = metadata !{}
turns into this:
define @foo(i32 %v) {
call void @llvm.foo(metadata i32 %v, metadata !0)
call void @llvm.foo(metadata i32 7, metadata !0)
call void @llvm.foo(metadata i32* @global, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{!3}, metadata !0)
ret void, !bar !2
}
!0 = !{!2}
!1 = !{i32* @global}
!2 = !{!3}
!3 = !{}
I wrote an upgrade script that handled almost all of the tests in llvm
and many of the tests in cfe (even handling many `CHECK` lines). I've
attached it (or will attach it in a moment if you're speedy) to PR21532
to help everyone update their out-of-tree testcases.
This is part of PR21532.
llvm-svn: 224257
2014-12-16 03:07:53 +08:00
|
|
|
!7 = !{null}
|
|
|
|
!8 = !{!9}
|
2015-08-01 02:58:39 +08:00
|
|
|
!9 = !DILocalVariable(name: "p", line: 4, scope: !4, file: !5, type: !10)
|
2015-04-30 00:38:44 +08:00
|
|
|
!10 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !11)
|
|
|
|
!11 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !12)
|
|
|
|
!12 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
|
[DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label.
In order to set breakpoints on labels and list source code around
labels, we need collect debug information for labels, i.e., label
name, the function label belong, line number in the file, and the
address label located. In order to keep these information in LLVM
IR and to allow backend to generate debug information correctly.
We create a new kind of metadata for labels, DILabel. The format
of DILabel is
!DILabel(scope: !1, name: "foo", file: !2, line: 3)
We hope to keep debug information as much as possible even the
code is optimized. So, we create a new kind of intrinsic for label
metadata to avoid the metadata is eliminated with basic block.
The intrinsic will keep existing if we keep it from optimized out.
The format of the intrinsic is
llvm.dbg.label(metadata !1)
It has only one argument, that is the DILabel metadata. The
intrinsic will follow the label immediately. Backend could get the
label metadata through the intrinsic's parameter.
We also create DIBuilder API for labels to be used by Frontend.
Frontend could use createLabel() to allocate DILabel objects, and use
insertLabel() to insert llvm.dbg.label intrinsic in LLVM IR.
Differential Revision: https://reviews.llvm.org/D45024
Patch by Hsiangkai Wang.
llvm-svn: 331841
2018-05-09 10:40:45 +08:00
|
|
|
!13 = distinct !DISubprogram(name: "main", line: 9, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 9, file: !1, scope: !5, type: !14, retainedNodes: !2)
|
2015-04-30 00:38:44 +08:00
|
|
|
!14 = !DISubroutineType(types: !15)
|
IR: Make metadata typeless in assembly
Now that `Metadata` is typeless, reflect that in the assembly. These
are the matching assembly changes for the metadata/value split in
r223802.
- Only use the `metadata` type when referencing metadata from a call
intrinsic -- i.e., only when it's used as a `Value`.
- Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode`
when referencing it from call intrinsics.
So, assembly like this:
define @foo(i32 %v) {
call void @llvm.foo(metadata !{i32 %v}, metadata !0)
call void @llvm.foo(metadata !{i32 7}, metadata !0)
call void @llvm.foo(metadata !1, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{metadata !3}, metadata !0)
ret void, !bar !2
}
!0 = metadata !{metadata !2}
!1 = metadata !{i32* @global}
!2 = metadata !{metadata !3}
!3 = metadata !{}
turns into this:
define @foo(i32 %v) {
call void @llvm.foo(metadata i32 %v, metadata !0)
call void @llvm.foo(metadata i32 7, metadata !0)
call void @llvm.foo(metadata i32* @global, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{!3}, metadata !0)
ret void, !bar !2
}
!0 = !{!2}
!1 = !{i32* @global}
!2 = !{!3}
!3 = !{}
I wrote an upgrade script that handled almost all of the tests in llvm
and many of the tests in cfe (even handling many `CHECK` lines). I've
attached it (or will attach it in a moment if you're speedy) to PR21532
to help everyone update their out-of-tree testcases.
This is part of PR21532.
llvm-svn: 224257
2014-12-16 03:07:53 +08:00
|
|
|
!15 = !{!12}
|
|
|
|
!16 = !{i32 2, !"Dwarf Version", i32 4}
|
2015-03-04 01:24:31 +08:00
|
|
|
!17 = !{i32 1, !"Debug Info Version", i32 3}
|
IR: Make metadata typeless in assembly
Now that `Metadata` is typeless, reflect that in the assembly. These
are the matching assembly changes for the metadata/value split in
r223802.
- Only use the `metadata` type when referencing metadata from a call
intrinsic -- i.e., only when it's used as a `Value`.
- Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode`
when referencing it from call intrinsics.
So, assembly like this:
define @foo(i32 %v) {
call void @llvm.foo(metadata !{i32 %v}, metadata !0)
call void @llvm.foo(metadata !{i32 7}, metadata !0)
call void @llvm.foo(metadata !1, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{metadata !3}, metadata !0)
ret void, !bar !2
}
!0 = metadata !{metadata !2}
!1 = metadata !{i32* @global}
!2 = metadata !{metadata !3}
!3 = metadata !{}
turns into this:
define @foo(i32 %v) {
call void @llvm.foo(metadata i32 %v, metadata !0)
call void @llvm.foo(metadata i32 7, metadata !0)
call void @llvm.foo(metadata i32* @global, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{!3}, metadata !0)
ret void, !bar !2
}
!0 = !{!2}
!1 = !{i32* @global}
!2 = !{!3}
!3 = !{}
I wrote an upgrade script that handled almost all of the tests in llvm
and many of the tests in cfe (even handling many `CHECK` lines). I've
attached it (or will attach it in a moment if you're speedy) to PR21532
to help everyone update their out-of-tree testcases.
This is part of PR21532.
llvm-svn: 224257
2014-12-16 03:07:53 +08:00
|
|
|
!18 = !{!"clang version 3.5.0 (trunk 207243) (llvm/trunk 207259)"}
|
2015-04-30 00:38:44 +08:00
|
|
|
!19 = !DILocation(line: 4, scope: !4)
|
|
|
|
!20 = !DILocation(line: 5, scope: !21)
|
|
|
|
!21 = distinct !DILexicalBlock(line: 5, column: 0, file: !1, scope: !4)
|
IR: Make metadata typeless in assembly
Now that `Metadata` is typeless, reflect that in the assembly. These
are the matching assembly changes for the metadata/value split in
r223802.
- Only use the `metadata` type when referencing metadata from a call
intrinsic -- i.e., only when it's used as a `Value`.
- Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode`
when referencing it from call intrinsics.
So, assembly like this:
define @foo(i32 %v) {
call void @llvm.foo(metadata !{i32 %v}, metadata !0)
call void @llvm.foo(metadata !{i32 7}, metadata !0)
call void @llvm.foo(metadata !1, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{metadata !3}, metadata !0)
ret void, !bar !2
}
!0 = metadata !{metadata !2}
!1 = metadata !{i32* @global}
!2 = metadata !{metadata !3}
!3 = metadata !{}
turns into this:
define @foo(i32 %v) {
call void @llvm.foo(metadata i32 %v, metadata !0)
call void @llvm.foo(metadata i32 7, metadata !0)
call void @llvm.foo(metadata i32* @global, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{!3}, metadata !0)
ret void, !bar !2
}
!0 = !{!2}
!1 = !{i32* @global}
!2 = !{!3}
!3 = !{}
I wrote an upgrade script that handled almost all of the tests in llvm
and many of the tests in cfe (even handling many `CHECK` lines). I've
attached it (or will attach it in a moment if you're speedy) to PR21532
to help everyone update their out-of-tree testcases.
This is part of PR21532.
llvm-svn: 224257
2014-12-16 03:07:53 +08:00
|
|
|
!22 = !{!"branch_weights", i32 1000, i32 1}
|
|
|
|
!23 = !{!24, !24, i64 0}
|
|
|
|
!24 = !{!"int", !25, i64 0}
|
|
|
|
!25 = !{!"omnipotent char", !26, i64 0}
|
|
|
|
!26 = !{!"Simple C/C++ TBAA"}
|
|
|
|
!27 = !{!"branch_weights", i32 1, i32 1000}
|
2015-04-30 00:38:44 +08:00
|
|
|
!28 = !DILocation(line: 6, scope: !21)
|
|
|
|
!29 = !DILocation(line: 7, scope: !4)
|
|
|
|
!30 = !DILocation(line: 4, scope: !4, inlinedAt: !31)
|
|
|
|
!31 = !DILocation(line: 10, scope: !13)
|
2015-08-01 02:58:39 +08:00
|
|
|
!32 = !DILocalVariable(name: "p", line: 4, scope: !4, file: !5, type: !10)
|
2015-04-30 00:38:44 +08:00
|
|
|
!33 = !DILocation(line: 5, scope: !21, inlinedAt: !31)
|
|
|
|
!34 = !DILocation(line: 6, scope: !21, inlinedAt: !31)
|
|
|
|
!35 = !DILocation(line: 7, scope: !4, inlinedAt: !31)
|
|
|
|
!36 = !DILocation(line: 11, scope: !13)
|