[PATCH] D58147: [CodeGen] Fix calling llvm.var.annotation outside of a basic block.
Volodymyr Sapsai via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 28 18:16:35 PST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL355166: [CodeGen] Fix calling llvm.var.annotation outside of a basic block. (authored by vsapsai, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D58147?vs=186542&id=188830#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58147/new/
https://reviews.llvm.org/D58147
Files:
cfe/trunk/lib/CodeGen/CGDecl.cpp
cfe/trunk/test/CodeGen/annotations-builtin.c
cfe/trunk/test/CodeGen/annotations-var.c
Index: cfe/trunk/test/CodeGen/annotations-var.c
===================================================================
--- cfe/trunk/test/CodeGen/annotations-var.c
+++ cfe/trunk/test/CodeGen/annotations-var.c
@@ -39,10 +39,19 @@
// LOCAL-NEXT: call void @llvm.var.annotation(i8* [[T0]], i8* getelementptr inbounds ([15 x i8], [15 x i8]* @{{.*}}), i8* getelementptr inbounds ({{.*}}), i32 33)
}
+void local_after_return(void) {
+ return;
+ int localvar __attribute__((annotate("localvar_after_return"))) = 3;
+// Test we are not emitting instructions like bitcast or call outside of a basic block.
+// LOCAL-LABEL: define void @local_after_return()
+// LOCAL: [[LOCALVAR:%.*]] = alloca i32,
+// LOCAL-NEXT: ret void
+}
+
void undef(void) {
int undefvar __attribute__((annotate("undefvar_ann_0")));
// UNDEF-LABEL: define void @undef()
// UNDEF: [[UNDEFVAR:%.*]] = alloca i32,
// UNDEF-NEXT: [[T0:%.*]] = bitcast i32* [[UNDEFVAR]] to i8*
-// UNDEF-NEXT: call void @llvm.var.annotation(i8* [[T0]], i8* getelementptr inbounds ([15 x i8], [15 x i8]* @{{.*}}), i8* getelementptr inbounds ({{.*}}), i32 43)
+// UNDEF-NEXT: call void @llvm.var.annotation(i8* [[T0]], i8* getelementptr inbounds ([15 x i8], [15 x i8]* @{{.*}}), i8* getelementptr inbounds ({{.*}}), i32 52)
}
Index: cfe/trunk/test/CodeGen/annotations-builtin.c
===================================================================
--- cfe/trunk/test/CodeGen/annotations-builtin.c
+++ cfe/trunk/test/CodeGen/annotations-builtin.c
@@ -43,4 +43,7 @@
// CHECK: call i32 @llvm.annotation.i32
// CHECK: inttoptr {{.*}} to i8**
return 0;
+
+ int after_return = __builtin_annotation(argc, "annotation_a");
+// CHECK-NOT: call i32 @llvm.annotation.i32
}
Index: cfe/trunk/lib/CodeGen/CGDecl.cpp
===================================================================
--- cfe/trunk/lib/CodeGen/CGDecl.cpp
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp
@@ -1577,7 +1577,7 @@
(void)DI->EmitDeclareOfAutoVariable(&D, address.getPointer(), Builder);
}
- if (D.hasAttr<AnnotateAttr>())
+ if (D.hasAttr<AnnotateAttr>() && HaveInsertPoint())
EmitVarAnnotations(&D, address.getPointer());
// Make sure we call @llvm.lifetime.end.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58147.188830.patch
Type: text/x-patch
Size: 2212 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190301/3f9cdf05/attachment-0001.bin>
More information about the cfe-commits
mailing list