mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
[InstCombine] Preserve !annotation on newly created instructions.
If the source instruction has !annotation metadata, all instructions created during combining should also have it. Tell the builder to add it. The !annotation system was discussed on llvm-dev as part of 'RFC: Combining Annotation Metadata and Remarks' (http://lists.llvm.org/pipermail/llvm-dev/2020-November/146393.html) This patch is based on an earlier patch by Francis Visoiu Mistrih. Reviewed By: thegameg, lebedev.ri Differential Revision: https://reviews.llvm.org/D91444
This commit is contained in:
parent
53e36ecab0
commit
5543ae6955
@ -3678,7 +3678,8 @@ bool InstCombinerImpl::run() {
|
||||
|
||||
// Now that we have an instruction, try combining it to simplify it.
|
||||
Builder.SetInsertPoint(I);
|
||||
Builder.CollectMetadataToCopy(I, {LLVMContext::MD_dbg});
|
||||
Builder.CollectMetadataToCopy(
|
||||
I, {LLVMContext::MD_dbg, LLVMContext::MD_annotation});
|
||||
|
||||
#ifndef NDEBUG
|
||||
std::string OrigI;
|
||||
|
@ -49,8 +49,8 @@ declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i1) n
|
||||
|
||||
define void @copy_1_byte(i8* %d, i8* %s) {
|
||||
; CHECK-LABEL: define {{.+}} @copy_1_byte({{.+}}
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = load i8, i8* [[S:%.*]], align 1
|
||||
; CHECK-NEXT: store i8 [[TMP1]], i8* [[D:%.*]], align 1
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = load i8, i8* [[S:%.*]], align 1, !annotation [[ANN]]
|
||||
; CHECK-NEXT: store i8 [[TMP1]], i8* [[D:%.*]], align 1, !annotation [[ANN]]
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
call void @llvm.memcpy.p0i8.p0i8.i32(i8* %d, i8* %s, i32 1, i1 false), !annotation !0
|
||||
@ -61,8 +61,8 @@ declare i8* @memcpy(i8* noalias returned, i8* noalias nocapture readonly, i64) n
|
||||
|
||||
define void @libcallcopy_1_byte(i8* %d, i8* %s) {
|
||||
; CHECK-LABEL: define {{.+}} @libcallcopy_1_byte({{.+}}
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = load i8, i8* [[S:%.*]], align 1
|
||||
; CHECK-NEXT: store i8 [[TMP1]], i8* [[D:%.*]], align 1
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = load i8, i8* [[S:%.*]], align 1, !annotation [[ANN]]
|
||||
; CHECK-NEXT: store i8 [[TMP1]], i8* [[D:%.*]], align 1, !annotation [[ANN]]
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
call i8* @memcpy(i8* %d, i8* %s, i64 1), !annotation !0
|
||||
@ -73,8 +73,8 @@ declare i8* @__memcpy_chk(i8*, i8*, i64, i64) nofree nounwind
|
||||
|
||||
define void @libcallcopy_1_byte_chk(i8* %d, i8* %s) {
|
||||
; CHECK-LABEL: define {{.+}} @libcallcopy_1_byte_chk({{.+}}
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = load i8, i8* [[S:%.*]], align 1
|
||||
; CHECK-NEXT: store i8 [[TMP1]], i8* [[D:%.*]], align 1
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = load i8, i8* [[S:%.*]], align 1, !annotation [[ANN]]
|
||||
; CHECK-NEXT: store i8 [[TMP1]], i8* [[D:%.*]], align 1, !annotation [[ANN]]
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
call i8* @__memcpy_chk(i8* %d, i8* %s, i64 1, i64 1), !annotation !0
|
||||
@ -85,8 +85,8 @@ declare void @llvm.memmove.p0i8.p0i8.i32(i8* nocapture, i8* nocapture readonly,
|
||||
|
||||
define void @move_1_byte(i8* %d, i8* %s) {
|
||||
; CHECK-LABEL: define {{.+}} @move_1_byte({{.+}}
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = load i8, i8* [[S:%.*]], align 1
|
||||
; CHECK-NEXT: store i8 [[TMP1]], i8* [[D:%.*]], align 1
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = load i8, i8* [[S:%.*]], align 1, !annotation [[ANN]]
|
||||
; CHECK-NEXT: store i8 [[TMP1]], i8* [[D:%.*]], align 1, !annotation [[ANN]]
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
call void @llvm.memmove.p0i8.p0i8.i32(i8* %d, i8* %s, i32 1, i1 false), !annotation !0
|
||||
@ -97,8 +97,8 @@ declare i8* @memmove(i8* returned, i8* nocapture readonly, i64) nofree nounwind
|
||||
|
||||
define void @libcallmove_1_byte(i8* %d, i8* %s) {
|
||||
; CHECK-LABEL: define {{.+}} @libcallmove_1_byte({{.+}}
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = load i8, i8* [[S:%.*]], align 1
|
||||
; CHECK-NEXT: store i8 [[TMP1]], i8* [[D:%.*]], align 1
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = load i8, i8* [[S:%.*]], align 1, !annotation [[ANN]]
|
||||
; CHECK-NEXT: store i8 [[TMP1]], i8* [[D:%.*]], align 1, !annotation [[ANN]]
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
call i8* @memmove(i8* %d, i8* %s, i64 1), !annotation !0
|
||||
@ -109,8 +109,8 @@ declare i8* @__memmove_chk(i8*, i8*, i64, i64) nofree nounwind
|
||||
|
||||
define void @libcallmove_1_byte_chk(i8* %d, i8* %s) {
|
||||
; CHECK-LABEL: define {{.+}} @libcallmove_1_byte_chk({{.+}}
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = load i8, i8* [[S:%.*]], align 1
|
||||
; CHECK-NEXT: store i8 [[TMP1]], i8* [[D:%.*]], align 1
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = load i8, i8* [[S:%.*]], align 1, !annotation [[ANN]]
|
||||
; CHECK-NEXT: store i8 [[TMP1]], i8* [[D:%.*]], align 1, !annotation [[ANN]]
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
call i8* @__memmove_chk(i8* %d, i8* %s, i64 1, i64 1), !annotation !0
|
||||
@ -121,7 +121,7 @@ declare void @llvm.memset.p0i8.i32(i8* nocapture writeonly, i8, i32, i1) argmemo
|
||||
|
||||
define void @set_1_byte(i8* %d) {
|
||||
; CHECK-LABEL: define {{.+}} @set_1_byte({{.+}}
|
||||
; CHECK-NEXT: store i8 1, i8* [[D:%.*]], align 1
|
||||
; CHECK-NEXT: store i8 1, i8* [[D:%.*]], align 1, !annotation [[ANN]]
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
call void @llvm.memset.p0i8.i32(i8* %d, i8 1, i32 1, i1 false), !annotation !0
|
||||
@ -132,7 +132,7 @@ declare i8* @memset(i8*, i32, i64) nofree
|
||||
|
||||
define void @libcall_set_1_byte(i8* %d) {
|
||||
; CHECK-LABEL: define {{.+}} @libcall_set_1_byte({{.+}}
|
||||
; CHECK-NEXT: store i8 1, i8* [[D:%.*]], align 1
|
||||
; CHECK-NEXT: store i8 1, i8* [[D:%.*]], align 1, !annotation [[ANN]]
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
call i8* @memset(i8* %d, i32 1, i64 1), !annotation !0
|
||||
@ -143,7 +143,7 @@ declare i8* @__memset_chk(i8*, i32, i64, i64) nofree
|
||||
|
||||
define void @libcall_set_1_byte_chk(i8* %d) {
|
||||
; CHECK-LABEL: define {{.+}} @libcall_set_1_byte_chk({{.+}}
|
||||
; CHECK-NEXT: store i8 1, i8* [[D:%.*]], align 1
|
||||
; CHECK-NEXT: store i8 1, i8* [[D:%.*]], align 1, !annotation [[ANN]]
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
call i8* @__memset_chk(i8* %d, i32 1, i64 1, i64 1), !annotation !0
|
||||
|
Loading…
x
Reference in New Issue
Block a user