llvm.org GIT mirror llvm / c2b7f5f
Drop @llvm.annotation and @llvm.ptr.annotation intrinsics during codegen. The intrinsic calls are dropped, but the annotated value is propagated. Fixes PR 15253 Original patch by Zeng Bin! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182387 91177308-0d34-0410-b5e6-96231b3b80d8 Justin Holewinski 7 years ago
4 changed file(s) with 44 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
452452 CI->replaceAllUsesWith(ConstantInt::get(CI->getType(), 1));
453453 break;
454454
455 case Intrinsic::annotation:
456 case Intrinsic::ptr_annotation:
457 // Just drop the annotation, but forward the value
458 CI->replaceAllUsesWith(CI->getOperand(0));
459 break;
460
455461 case Intrinsic::var_annotation:
456462 break; // Strip out annotate intrinsic
457463
50365036 setValue(&I, Res);
50375037 return 0;
50385038 }
5039 case Intrinsic::annotation:
5040 case Intrinsic::ptr_annotation:
5041 // Drop the intrinsic, but forward the value
5042 setValue(&I, getValue(I.getOperand(0)));
5043 return 0;
50395044 case Intrinsic::var_annotation:
50405045 // Discard annotate attributes
50415046 return 0;
0 ; RUN: llc < %s
1
2 ; PR15253
3
4 @.str = private unnamed_addr constant [4 x i8] c"sth\00", section "llvm.metadata"
5 @.str1 = private unnamed_addr constant [4 x i8] c"t.c\00", section "llvm.metadata"
6
7
8 define i32 @foo(i32 %a) {
9 entry:
10 %0 = call i32 @llvm.annotation.i32(i32 %a, i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8]* @.str1, i32 0, i32 0), i32 2)
11 ret i32 %0
12 }
13
14 declare i32 @llvm.annotation.i32(i32, i8*, i8*, i32) #1
0 ; RUN: llc < %s
1
2 ; PR15253
3
4 %struct.mystruct = type { i32 }
5
6 @.str = private unnamed_addr constant [4 x i8] c"sth\00", section "llvm.metadata"
7 @.str1 = private unnamed_addr constant [4 x i8] c"t.c\00", section "llvm.metadata"
8
9 define void @foo() {
10 entry:
11 %m = alloca i8, align 4
12 %0 = call i8* @llvm.ptr.annotation.p0i8(i8* %m, i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8]* @.str1, i32 0, i32 0), i32 2)
13 store i8 1, i8* %0, align 4
14 ret void
15 }
16
17 declare i8* @llvm.ptr.annotation.p0i8(i8*, i8*, i8*, i32) #1