[PATCH] D88114: [clang]Test ensuring -fembed-bitcode passed to cc1 captures pre-opt bitcode.

Mircea Trofin via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 22 13:35:53 PDT 2020


mtrofin created this revision.
mtrofin added reviewers: steven_wu, tejohnson.
Herald added a reviewer: alexshap.
Herald added subscribers: cfe-commits, dexonsmith.
Herald added a project: clang.
mtrofin requested review of this revision.

This is important to not regress because it allows us to capture pre-optimization
bitcode and options, and replay the full optimization pipeline.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88114

Files:
  clang/test/Frontend/embed-bitcode-noopt.ll


Index: clang/test/Frontend/embed-bitcode-noopt.ll
===================================================================
--- /dev/null
+++ clang/test/Frontend/embed-bitcode-noopt.ll
@@ -0,0 +1,22 @@
+; Ensure calling bypassing the driver with -fembed-bitcode embeds bitcode pre-
+; optimizations
+
+; RUN: %clang_cc1 -O2 -triple x86_64-unknown-linux-gnu -emit-obj %s -o %t.o -fembed-bitcode=all
+; RUN: llvm-objcopy --dump-section=.llvmbc=%t.bc %t.o /dev/null
+
+; Also check that the .llvmcmd section captures the optimization options.
+; RUN: llvm-dis %t.bc -o - | FileCheck %s --check-prefix=CHECK-BC
+; RUN: llvm-objcopy --dump-section=.llvmcmd=- %t.o /dev/null | FileCheck %s --check-prefix=CHECK-CMD
+
+; CHECK-BC-LABEL: @foo
+; CHECK-BC-NEXT: call void @bar
+; CHECK-CMD: -O2
+
+define void @bar() {
+    ret void
+}
+
+define void @foo() {
+  call void @bar()
+  ret void
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88114.293560.patch
Type: text/x-patch
Size: 880 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200922/73a362ee/attachment.bin>


More information about the cfe-commits mailing list