[PATCH] D107039: [Bitcode][Asm] Read metadata value from operand bundles in and out

Necip Fazil Yildiran via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 28 23:09:38 PDT 2021


necipfazil created this revision.
necipfazil requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This revision does not contain any changes but how the expected changes
should be tested.

Metadata operand bundle value is garbage when LLVM IR is compiled to
bitcode, then disassembled back to LLVM IR, like the tests do in this
revision. Fixing the issue should have the tests pass.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107039

Files:
  llvm/test/Bitcode/2021-07-22-Metadata-Operand-Bundles.ll
  llvm/test/Bitcode/compatibility.ll
  llvm/test/Bitcode/operand-bundles.ll


Index: llvm/test/Bitcode/operand-bundles.ll
===================================================================
--- llvm/test/Bitcode/operand-bundles.ll
+++ llvm/test/Bitcode/operand-bundles.ll
@@ -56,6 +56,14 @@
   ret void
 }
 
+define void @f5(i32* %ptr) {
+; CHECK-LABEL: @f5(
+ entry:
+  call void @callee0() [ "foo"(metadata !"metadata_string") ]
+; CHECK: call void @callee0() [ "foo"(metadata !"metadata_string") ]
+  ret void
+}
+
 ; Invoke versions of the above tests:
 
 
@@ -150,3 +158,16 @@
 normal:
   ret void
 }
+
+define void @g5(i32* %ptr) personality i8 3 {
+; CHECK-LABEL: @g5(
+ entry:
+  invoke void @callee0() [ "foo"(metadata !"metadata_string") ] to label %normal unwind label %exception
+; CHECK: invoke void @callee0() [ "foo"(metadata !"metadata_string") ]
+
+exception:
+  %cleanup = landingpad i8 cleanup
+  br label %normal
+normal:
+  ret void
+}
Index: llvm/test/Bitcode/compatibility.ll
===================================================================
--- llvm/test/Bitcode/compatibility.ll
+++ llvm/test/Bitcode/compatibility.ll
@@ -1771,6 +1771,14 @@
   ret void
 }
 
+define void @call_with_operand_bundle5(i32* %ptr) {
+; CHECK-LABEL: call_with_operand_bundle5(
+ entry:
+  call void @op_bundle_callee_0() [ "foo"(metadata !"metadata_string") ]
+; CHECK: call void @op_bundle_callee_0() [ "foo"(metadata !"metadata_string") ]
+  ret void
+}
+
 ; Invoke versions of the above tests:
 
 
@@ -1866,6 +1874,19 @@
   ret void
 }
 
+define void @invoke_with_operand_bundle5(i32* %ptr) personality i8 3 {
+; CHECK-LABEL: @invoke_with_operand_bundle5(
+ entry:
+  invoke void @op_bundle_callee_0() [ "foo"(metadata !"metadata_string") ] to label %normal unwind label %exception
+; CHECK: invoke void @op_bundle_callee_0() [ "foo"(metadata !"metadata_string") ]
+
+exception:
+  %cleanup = landingpad i8 cleanup
+  br label %normal
+normal:
+  ret void
+}
+
 declare void @vaargs_func(...)
 define void @invoke_with_operand_bundle_vaarg(i32* %ptr) personality i8 3 {
 ; CHECK-LABEL: @invoke_with_operand_bundle_vaarg(
Index: llvm/test/Bitcode/2021-07-22-Metadata-Operand-Bundles.ll
===================================================================
--- /dev/null
+++ llvm/test/Bitcode/2021-07-22-Metadata-Operand-Bundles.ll
@@ -0,0 +1,12 @@
+; This test ensures that we get a metadata operand bundle value in and out.
+; RUN: llvm-as < %s | llvm-dis | FileCheck %s
+
+declare void @callee()
+
+; CHECK-LABEL: call_with_operand_bundle(
+define void @call_with_operand_bundle() {
+  ; CHECK: call void @op_bundle_callee() [ "op_type"(metadata !"metadata_string") ]
+  call void @callee() [ "op_type"(metadata !"metadata_string") ]
+
+  ret void
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107039.362650.patch
Type: text/x-patch
Size: 2679 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210729/02237506/attachment.bin>


More information about the llvm-commits mailing list