[llvm] r271072 - [PM] Port the Sample FDO to new PM (part-2)

Xinliang David Li via llvm-commits llvm-commits at lists.llvm.org
Fri May 27 16:20:17 PDT 2016


Author: davidxl
Date: Fri May 27 18:20:16 2016
New Revision: 271072

URL: http://llvm.org/viewvc/llvm-project?rev=271072&view=rev
Log:
[PM] Port the Sample FDO to new PM (part-2)

Added:
    llvm/trunk/include/llvm/Transforms/SampleProfile.h
Modified:
    llvm/trunk/lib/Passes/PassBuilder.cpp
    llvm/trunk/lib/Passes/PassRegistry.def
    llvm/trunk/lib/Transforms/IPO/SampleProfile.cpp
    llvm/trunk/test/Transforms/SampleProfile/branch.ll
    llvm/trunk/test/Transforms/SampleProfile/calls.ll
    llvm/trunk/test/Transforms/SampleProfile/cov-zero-samples.ll
    llvm/trunk/test/Transforms/SampleProfile/coverage-warning.ll
    llvm/trunk/test/Transforms/SampleProfile/discriminator.ll
    llvm/trunk/test/Transforms/SampleProfile/entry_counts.ll
    llvm/trunk/test/Transforms/SampleProfile/fnptr.ll
    llvm/trunk/test/Transforms/SampleProfile/gcc-simple.ll
    llvm/trunk/test/Transforms/SampleProfile/inline-combine.ll
    llvm/trunk/test/Transforms/SampleProfile/inline-coverage.ll
    llvm/trunk/test/Transforms/SampleProfile/inline-hint.ll
    llvm/trunk/test/Transforms/SampleProfile/inline.ll
    llvm/trunk/test/Transforms/SampleProfile/nolocinfo.ll
    llvm/trunk/test/Transforms/SampleProfile/offset.ll
    llvm/trunk/test/Transforms/SampleProfile/propagate.ll
    llvm/trunk/test/Transforms/SampleProfile/remarks.ll
    llvm/trunk/test/Transforms/SampleProfile/syntax.ll

Added: llvm/trunk/include/llvm/Transforms/SampleProfile.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/SampleProfile.h?rev=271072&view=auto
==============================================================================
--- llvm/trunk/include/llvm/Transforms/SampleProfile.h (added)
+++ llvm/trunk/include/llvm/Transforms/SampleProfile.h Fri May 27 18:20:16 2016
@@ -0,0 +1,27 @@
+//===- Transforms/SampleProfile.h - SamplePGO pass--------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+/// \file
+/// This file provides the interface for the sampled PGO loader pass.
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_TRANSFORMS_SAMPLEPROFILE_H
+#define LLVM_TRANSFORMS_SAMPLEPROFILE_H
+
+#include "llvm/IR/PassManager.h"
+
+namespace llvm {
+
+/// The instrumentation (profile-instr-gen) pass for IR based PGO.
+class SampleProfileLoaderPass : public PassInfoMixin<SampleProfileLoaderPass> {
+public:
+  PreservedAnalyses run(Module &M, AnalysisManager<Module> &AM);
+};
+
+} // End llvm namespace
+#endif

Modified: llvm/trunk/lib/Passes/PassBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Passes/PassBuilder.cpp?rev=271072&r1=271071&r2=271072&view=diff
==============================================================================
--- llvm/trunk/lib/Passes/PassBuilder.cpp (original)
+++ llvm/trunk/lib/Passes/PassBuilder.cpp Fri May 27 18:20:16 2016
@@ -62,6 +62,7 @@
 #include "llvm/Transforms/InstCombine/InstCombine.h"
 #include "llvm/Transforms/InstrProfiling.h"
 #include "llvm/Transforms/PGOInstrumentation.h"
+#include "llvm/Transforms/SampleProfile.h"
 #include "llvm/Transforms/Scalar/ADCE.h"
 #include "llvm/Transforms/Scalar/BDCE.h"
 #include "llvm/Transforms/Scalar/DCE.h"

Modified: llvm/trunk/lib/Passes/PassRegistry.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Passes/PassRegistry.def?rev=271072&r1=271071&r2=271072&view=diff
==============================================================================
--- llvm/trunk/lib/Passes/PassRegistry.def (original)
+++ llvm/trunk/lib/Passes/PassRegistry.def Fri May 27 18:20:16 2016
@@ -53,6 +53,7 @@ MODULE_PASS("pgo-instr-use", PGOInstrume
 MODULE_PASS("print", PrintModulePass(dbgs()))
 MODULE_PASS("print-callgraph", CallGraphPrinterPass(dbgs()))
 MODULE_PASS("print-lcg", LazyCallGraphPrinterPass(dbgs()))
+MODULE_PASS("sample-profile", SampleProfileLoaderPass())
 MODULE_PASS("strip-dead-prototypes", StripDeadPrototypesPass())
 MODULE_PASS("verify", VerifierPass())
 #undef MODULE_PASS

Modified: llvm/trunk/lib/Transforms/IPO/SampleProfile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/SampleProfile.cpp?rev=271072&r1=271071&r2=271072&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/SampleProfile.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/SampleProfile.cpp Fri May 27 18:20:16 2016
@@ -22,6 +22,7 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "llvm/Transforms/SampleProfile.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/SmallSet.h"
@@ -34,8 +35,8 @@
 #include "llvm/IR/Dominators.h"
 #include "llvm/IR/Function.h"
 #include "llvm/IR/InstIterator.h"
-#include "llvm/IR/IntrinsicInst.h"
 #include "llvm/IR/Instructions.h"
+#include "llvm/IR/IntrinsicInst.h"
 #include "llvm/IR/LLVMContext.h"
 #include "llvm/IR/MDBuilder.h"
 #include "llvm/IR/Metadata.h"
@@ -1225,10 +1226,8 @@ bool SampleProfileLoader::emitAnnotation
 }
 
 char SampleProfileLoaderLegacyPass::ID = 0;
-INITIALIZE_PASS_BEGIN(SampleProfileLoaderLegacyPass, "sample-profile",
-                      "Sample Profile loader", false, false)
-INITIALIZE_PASS_END(SampleProfileLoaderLegacyPass, "sample-profile",
-                    "Sample Profile loader", false, false)
+INITIALIZE_PASS(SampleProfileLoaderLegacyPass, "sample-profile",
+                "Sample Profile loader", false, false)
 
 bool SampleProfileLoader::doInitialization(Module &M) {
   auto &Ctx = M.getContext();
@@ -1279,3 +1278,16 @@ bool SampleProfileLoader::runOnFunction(
     return emitAnnotations(F);
   return false;
 }
+
+PreservedAnalyses SampleProfileLoaderPass::run(Module &M,
+                                               AnalysisManager<Module> &AM) {
+
+  SampleProfileLoader SampleLoader(SampleProfileFile);
+
+  SampleLoader.doInitialization(M);
+
+  if (!SampleLoader.runOnModule(M))
+    return PreservedAnalyses::all();
+
+  return PreservedAnalyses::none();
+}

Modified: llvm/trunk/test/Transforms/SampleProfile/branch.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SampleProfile/branch.ll?rev=271072&r1=271071&r2=271072&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/SampleProfile/branch.ll (original)
+++ llvm/trunk/test/Transforms/SampleProfile/branch.ll Fri May 27 18:20:16 2016
@@ -1,4 +1,5 @@
 ; RUN: opt < %s -sample-profile -sample-profile-file=%S/Inputs/branch.prof | opt -analyze -branch-prob | FileCheck %s
+; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/branch.prof | opt -analyze -branch-prob | FileCheck %s
 
 ; Original C++ code for this test case:
 ;

Modified: llvm/trunk/test/Transforms/SampleProfile/calls.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SampleProfile/calls.ll?rev=271072&r1=271071&r2=271072&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/SampleProfile/calls.ll (original)
+++ llvm/trunk/test/Transforms/SampleProfile/calls.ll Fri May 27 18:20:16 2016
@@ -1,4 +1,5 @@
 ; RUN: opt < %s -instcombine -sample-profile -sample-profile-file=%S/Inputs/calls.prof | opt -analyze -branch-prob | FileCheck %s
+; RUN: opt < %s -passes="function(instcombine),sample-profile" -sample-profile-file=%S/Inputs/calls.prof | opt -analyze -branch-prob | FileCheck %s
 
 ; Original C++ test case
 ;

Modified: llvm/trunk/test/Transforms/SampleProfile/cov-zero-samples.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SampleProfile/cov-zero-samples.ll?rev=271072&r1=271071&r2=271072&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/SampleProfile/cov-zero-samples.ll (original)
+++ llvm/trunk/test/Transforms/SampleProfile/cov-zero-samples.ll Fri May 27 18:20:16 2016
@@ -1,4 +1,5 @@
 ; RUN: opt < %s -instcombine -sample-profile -sample-profile-file=%S/Inputs/cov-zero-samples.prof -sample-profile-check-record-coverage=100 -pass-remarks=sample-profile -o /dev/null 2>&1 | FileCheck %s
+; RUN: opt < %s -passes="function(instcombine),sample-profile" -sample-profile-file=%S/Inputs/cov-zero-samples.prof -sample-profile-check-record-coverage=100 -pass-remarks=sample-profile -o /dev/null 2>&1 | FileCheck %s
 ;
 ; CHECK: remark: cov-zero-samples.cc:9:29: Applied 404065 samples from profile (offset: 2.1)
 ; CHECK: remark: cov-zero-samples.cc:10:9: Applied 443089 samples from profile (offset: 3)

Modified: llvm/trunk/test/Transforms/SampleProfile/coverage-warning.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SampleProfile/coverage-warning.ll?rev=271072&r1=271071&r2=271072&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/SampleProfile/coverage-warning.ll (original)
+++ llvm/trunk/test/Transforms/SampleProfile/coverage-warning.ll Fri May 27 18:20:16 2016
@@ -1,4 +1,5 @@
 ; RUN: opt < %s -sample-profile -sample-profile-file=%S/Inputs/coverage-warning.prof -sample-profile-check-record-coverage=90 -sample-profile-check-sample-coverage=100 -o /dev/null 2>&1 | FileCheck %s
+; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/coverage-warning.prof -sample-profile-check-record-coverage=90 -sample-profile-check-sample-coverage=100 -o /dev/null 2>&1 | FileCheck %s
 define i32 @foo(i32 %i) !dbg !4 {
 ; The profile has samples for line locations that are no longer present.
 ; Coverage does not reach 90%, so we should get this warning:

Modified: llvm/trunk/test/Transforms/SampleProfile/discriminator.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SampleProfile/discriminator.ll?rev=271072&r1=271071&r2=271072&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/SampleProfile/discriminator.ll (original)
+++ llvm/trunk/test/Transforms/SampleProfile/discriminator.ll Fri May 27 18:20:16 2016
@@ -1,4 +1,5 @@
 ; RUN: opt < %s -sample-profile -sample-profile-file=%S/Inputs/discriminator.prof | opt -analyze -branch-prob | FileCheck %s
+; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/discriminator.prof | opt -analyze -branch-prob | FileCheck %s
 
 ; Original code
 ;

Modified: llvm/trunk/test/Transforms/SampleProfile/entry_counts.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SampleProfile/entry_counts.ll?rev=271072&r1=271071&r2=271072&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/SampleProfile/entry_counts.ll (original)
+++ llvm/trunk/test/Transforms/SampleProfile/entry_counts.ll Fri May 27 18:20:16 2016
@@ -1,4 +1,5 @@
 ; RUN: opt < %s -sample-profile -sample-profile-file=%S/Inputs/entry_counts.prof -S | FileCheck %s
+; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/entry_counts.prof -S | FileCheck %s
 
 ; According to the profile, function empty() was called 13,293 times.
 ; CHECK: {{.*}} = !{!"function_entry_count", i64 13293}

Modified: llvm/trunk/test/Transforms/SampleProfile/fnptr.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SampleProfile/fnptr.ll?rev=271072&r1=271071&r2=271072&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/SampleProfile/fnptr.ll (original)
+++ llvm/trunk/test/Transforms/SampleProfile/fnptr.ll Fri May 27 18:20:16 2016
@@ -5,6 +5,9 @@
 ; RUN: opt < %s -sample-profile -sample-profile-file=%S/Inputs/fnptr.prof | opt -analyze -branch-prob | FileCheck %s
 ; RUN: opt < %s -sample-profile -sample-profile-file=%S/Inputs/fnptr.binprof | opt -analyze -branch-prob | FileCheck %s
 
+; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/fnptr.prof | opt -analyze -branch-prob | FileCheck %s
+; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/fnptr.binprof | opt -analyze -branch-prob | FileCheck %s
+
 ; CHECK:   edge for.body3 -> if.then probability is 0x1a4f3959 / 0x80000000 = 20.55%
 ; CHECK:   edge for.body3 -> if.else probability is 0x65b0c6a7 / 0x80000000 = 79.45%
 ; CHECK:   edge for.inc -> for.inc12 probability is 0x33d4a4c1 / 0x80000000 = 40.49%

Modified: llvm/trunk/test/Transforms/SampleProfile/gcc-simple.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SampleProfile/gcc-simple.ll?rev=271072&r1=271071&r2=271072&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/SampleProfile/gcc-simple.ll (original)
+++ llvm/trunk/test/Transforms/SampleProfile/gcc-simple.ll Fri May 27 18:20:16 2016
@@ -1,4 +1,5 @@
 ; RUN: opt < %s -sample-profile -sample-profile-file=%S/Inputs/gcc-simple.afdo -S | FileCheck %s
+; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/gcc-simple.afdo -S | FileCheck %s
 ; XFAIL: powerpc64-, s390x, mips-, mips64-, sparc
 ; Original code:
 ;

Modified: llvm/trunk/test/Transforms/SampleProfile/inline-combine.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SampleProfile/inline-combine.ll?rev=271072&r1=271071&r2=271072&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/SampleProfile/inline-combine.ll (original)
+++ llvm/trunk/test/Transforms/SampleProfile/inline-combine.ll Fri May 27 18:20:16 2016
@@ -1,4 +1,5 @@
 ; RUN: opt < %s -instcombine -sample-profile -sample-profile-file=%S/Inputs/inline-combine.prof -S | FileCheck %s
+; RUN: opt < %s -passes="function(instcombine),sample-profile" -sample-profile-file=%S/Inputs/inline-combine.prof -S | FileCheck %s
 
 %"class.llvm::FoldingSetNodeID" = type { %"class.llvm::SmallVector" }
 %"class.llvm::SmallVector" = type { %"class.llvm::SmallVectorImpl.base", %"struct.llvm::SmallVectorStorage" }

Modified: llvm/trunk/test/Transforms/SampleProfile/inline-coverage.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SampleProfile/inline-coverage.ll?rev=271072&r1=271071&r2=271072&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/SampleProfile/inline-coverage.ll (original)
+++ llvm/trunk/test/Transforms/SampleProfile/inline-coverage.ll Fri May 27 18:20:16 2016
@@ -1,4 +1,5 @@
 ; RUN: opt < %s -instcombine -sample-profile -sample-profile-file=%S/Inputs/inline-coverage.prof -sample-profile-check-record-coverage=100 -sample-profile-check-sample-coverage=110 -pass-remarks=sample-profile -o /dev/null 2>&1 | FileCheck %s
+; RUN: opt < %s -passes="function(instcombine),sample-profile" -sample-profile-file=%S/Inputs/inline-coverage.prof -sample-profile-check-record-coverage=100 -sample-profile-check-sample-coverage=110 -pass-remarks=sample-profile -o /dev/null 2>&1 | FileCheck %s
 ;
 ; Original code:
 ;

Modified: llvm/trunk/test/Transforms/SampleProfile/inline-hint.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SampleProfile/inline-hint.ll?rev=271072&r1=271071&r2=271072&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/SampleProfile/inline-hint.ll (original)
+++ llvm/trunk/test/Transforms/SampleProfile/inline-hint.ll Fri May 27 18:20:16 2016
@@ -1,4 +1,5 @@
 ; RUN: opt %s -sample-profile -sample-profile-file=%S/Inputs/inline-hint.prof -pass-remarks=sample-profile -o /dev/null 2>&1 | FileCheck %s
+; RUN: opt %s -passes=sample-profile -sample-profile-file=%S/Inputs/inline-hint.prof -pass-remarks=sample-profile -o /dev/null 2>&1 | FileCheck %s
 ;
 ; CHECK: Applied cold hint to globally cold function '_Z7cold_fnRxi' with 0.1
 define void @_Z7cold_fnRxi() !dbg !4 {

Modified: llvm/trunk/test/Transforms/SampleProfile/inline.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SampleProfile/inline.ll?rev=271072&r1=271071&r2=271072&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/SampleProfile/inline.ll (original)
+++ llvm/trunk/test/Transforms/SampleProfile/inline.ll Fri May 27 18:20:16 2016
@@ -1,4 +1,5 @@
 ; RUN: opt < %s -sample-profile -sample-profile-file=%S/Inputs/inline.prof -sample-profile-inline-hot-threshold=1 -S | FileCheck %s
+; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/inline.prof -sample-profile-inline-hot-threshold=1 -S | FileCheck %s
 
 ; Original C++ test case
 ;

Modified: llvm/trunk/test/Transforms/SampleProfile/nolocinfo.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SampleProfile/nolocinfo.ll?rev=271072&r1=271071&r2=271072&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/SampleProfile/nolocinfo.ll (original)
+++ llvm/trunk/test/Transforms/SampleProfile/nolocinfo.ll Fri May 27 18:20:16 2016
@@ -1,4 +1,5 @@
 ; RUN: opt < %s -sample-profile -sample-profile-file=%S/Inputs/nolocinfo.prof -S -pass-remarks=sample-profile 2>&1 | FileCheck %s
+; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/nolocinfo.prof -S -pass-remarks=sample-profile 2>&1 | FileCheck %s
 
 define i32 @foo(i32 %i)  !dbg !4 {
 entry:

Modified: llvm/trunk/test/Transforms/SampleProfile/offset.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SampleProfile/offset.ll?rev=271072&r1=271071&r2=271072&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/SampleProfile/offset.ll (original)
+++ llvm/trunk/test/Transforms/SampleProfile/offset.ll Fri May 27 18:20:16 2016
@@ -1,4 +1,5 @@
 ; RUN: opt < %s -sample-profile -sample-profile-file=%S/Inputs/offset.prof | opt -analyze -branch-prob | FileCheck %s
+; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/offset.prof | opt -analyze -branch-prob | FileCheck %s
 
 ; Original C++ code for this test case:
 ;

Modified: llvm/trunk/test/Transforms/SampleProfile/propagate.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SampleProfile/propagate.ll?rev=271072&r1=271071&r2=271072&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/SampleProfile/propagate.ll (original)
+++ llvm/trunk/test/Transforms/SampleProfile/propagate.ll Fri May 27 18:20:16 2016
@@ -1,4 +1,5 @@
 ; RUN: opt < %s -sample-profile -sample-profile-file=%S/Inputs/propagate.prof | opt -analyze -branch-prob | FileCheck %s
+; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/propagate.prof | opt -analyze -branch-prob | FileCheck %s
 
 ; Original C++ code for this test case:
 ;

Modified: llvm/trunk/test/Transforms/SampleProfile/remarks.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SampleProfile/remarks.ll?rev=271072&r1=271071&r2=271072&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/SampleProfile/remarks.ll (original)
+++ llvm/trunk/test/Transforms/SampleProfile/remarks.ll Fri May 27 18:20:16 2016
@@ -1,4 +1,5 @@
 ; RUN: opt < %s -sample-profile -sample-profile-file=%S/Inputs/remarks.prof -S -pass-remarks=sample-profile 2>&1 | FileCheck %s
+; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/remarks.prof -S -pass-remarks=sample-profile 2>&1 | FileCheck %s
 ;
 ; Original test case.
 ;

Modified: llvm/trunk/test/Transforms/SampleProfile/syntax.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SampleProfile/syntax.ll?rev=271072&r1=271071&r2=271072&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/SampleProfile/syntax.ll (original)
+++ llvm/trunk/test/Transforms/SampleProfile/syntax.ll Fri May 27 18:20:16 2016
@@ -7,6 +7,15 @@
 ; RUN: not opt < %s -sample-profile -sample-profile-file=%S/Inputs/bad_samples.prof 2>&1 | FileCheck -check-prefix=BAD-SAMPLES %s
 ; RUN: opt < %s -sample-profile -sample-profile-file=%S/Inputs/bad_mangle.prof 2>&1 >/dev/null
 
+; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/syntax.prof 2>&1 | FileCheck -check-prefix=NO-DEBUG %s
+; RUN: not opt < %s -passes=sample-profile -sample-profile-file=missing.prof 2>&1 | FileCheck -check-prefix=MISSING-FILE %s
+; RUN: not opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/bad_fn_header.prof 2>&1 | FileCheck -check-prefix=BAD-FN-HEADER %s
+; RUN: not opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/bad_sample_line.prof 2>&1 | FileCheck -check-prefix=BAD-SAMPLE-LINE %s
+; RUN: not opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/bad_line_values.prof 2>&1 | FileCheck -check-prefix=BAD-LINE-VALUES %s
+; RUN: not opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/bad_discriminator_value.prof 2>&1 | FileCheck -check-prefix=BAD-DISCRIMINATOR-VALUE %s
+; RUN: not opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/bad_samples.prof 2>&1 | FileCheck -check-prefix=BAD-SAMPLES %s
+; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/bad_mangle.prof 2>&1 >/dev/null
+
 define void @empty() {
 entry:
   ret void




More information about the llvm-commits mailing list