diff --git a/llvm/test/Bitcode/2021-07-22-Metadata-Operand-Bundles.ll b/llvm/test/Bitcode/2021-07-22-Metadata-Operand-Bundles.ll new file mode 100644 index 0000000000000..8080e13af67fc --- /dev/null +++ b/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 +} diff --git a/llvm/test/Bitcode/compatibility.ll b/llvm/test/Bitcode/compatibility.ll index b374924516d66..935e7af9a599c 100644 --- a/llvm/test/Bitcode/compatibility.ll +++ b/llvm/test/Bitcode/compatibility.ll @@ -1819,6 +1819,14 @@ define void @call_with_operand_bundle4(ptr %ptr) { ret void } +define void @call_with_operand_bundle5(ptr %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: @@ -1914,6 +1922,19 @@ normal: ret void } +define void @invoke_with_operand_bundle5(ptr %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(ptr %ptr) personality i8 3 { ; CHECK-LABEL: @invoke_with_operand_bundle_vaarg( diff --git a/llvm/test/Bitcode/operand-bundles.ll b/llvm/test/Bitcode/operand-bundles.ll index ab28cffd84aa2..99591672656e8 100644 --- a/llvm/test/Bitcode/operand-bundles.ll +++ b/llvm/test/Bitcode/operand-bundles.ll @@ -58,6 +58,13 @@ define void @f4(i32* %ptr) { ; Invoke versions of the above tests: +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 +} define void @g0(i32* %ptr) personality i8 3 { ; CHECK-LABEL: @g0( @@ -150,3 +157,16 @@ exception: 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 +} \ No newline at end of file