-; RUN: llvm-reduce --delta-passes=module-inline-asm --test FileCheck --test-arg --check-prefixes=CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
+; RUN: llvm-reduce --delta-passes=module-data --test FileCheck --test-arg --check-prefixes=CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
; RUN: FileCheck --check-prefix=CHECK-NOCHANGE %s < %t
; RUN: llvm-reduce --delta-passes=function-bodies --test FileCheck --test-arg --check-prefixes=CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
; RUN: FileCheck --check-prefix=CHECK-CHANGE %s < %t
-; RUN: llvm-reduce --delta-passes=function-bodies,module-inline-asm --test FileCheck --test-arg --check-prefixes=CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
+; RUN: llvm-reduce --delta-passes=function-bodies,module-data --test FileCheck --test-arg --check-prefixes=CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
; RUN: FileCheck --check-prefix=CHECK-CHANGE %s < %t
; RUN: not llvm-reduce --delta-passes=foo --test FileCheck --test-arg --check-prefixes=CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t 2>&1 | FileCheck %s --check-prefix=ERROR
-; RUN: not llvm-reduce --delta-passes='function-bodies;module-inline-asm' --test FileCheck --test-arg --check-prefixes=CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t 2>&1 | FileCheck %s --check-prefix=ERROR
+; RUN: not llvm-reduce --delta-passes='function-bodies;module-data' --test FileCheck --test-arg --check-prefixes=CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t 2>&1 | FileCheck %s --check-prefix=ERROR
; RUN: llvm-reduce --print-delta-passes --test FileCheck %s 2>&1 | FileCheck %s --check-prefix=PRINT
--- /dev/null
+; REQUIRES: x86-registered-target
+
+; RUN: opt %s -S | FileCheck --check-prefix=CHECK-FILE %s
+; RUN: llvm-reduce --test FileCheck --test-arg --check-prefixes=CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
+; RUN: FileCheck --check-prefix=CHECK-FINAL %s < %t
+
+; CHECK-INTERESTINGNESS: declare
+
+; CHECK-FILE: ModuleID
+; CHECK-FILE: source_filename
+; CHECK-FILE: datalayout
+; CHECK-FILE: triple
+; CHECK-FILE: module asm
+; CHECK-FILE: declare void @g
+
+; CHECK-FINAL-NOT: ModuleID
+; CHECK-FINAL-NOT: source_filename
+; CHECK-FINAL-NOT: datalayout
+; CHECK-FINAL-NOT: triple
+; CHECK-FINAL-NOT: module asm
+; CHECK-FINAL: declare void @g
+
+source_filename = "/tmp/a.cc"
+target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+module asm "foo"
+
+declare void @g()
+++ /dev/null
-; RUN: llvm-reduce --test FileCheck --test-arg --check-prefixes=CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
-; RUN: FileCheck --check-prefix=CHECK-FINAL %s < %t
-
-; CHECK-INTERESTINGNESS: declare
-
-; CHECK-FINAL-NOT: module asm
-; CHECK-FINAL: declare void @g
-
-module asm "foo"
-
-declare void @g()
deltas/ReduceGlobalVars.cpp
deltas/ReduceInstructions.cpp
deltas/ReduceMetadata.cpp
- deltas/ReduceModuleInlineAsm.cpp
+ deltas/ReduceModuleData.cpp
deltas/ReduceOperandBundles.cpp
deltas/ReduceSpecialGlobals.cpp
llvm-reduce.cpp
#include "deltas/ReduceGlobalVars.h"
#include "deltas/ReduceInstructions.h"
#include "deltas/ReduceMetadata.h"
-#include "deltas/ReduceModuleInlineAsm.h"
+#include "deltas/ReduceModuleData.h"
#include "deltas/ReduceOperandBundles.h"
#include "deltas/ReduceSpecialGlobals.h"
#include "llvm/Support/CommandLine.h"
DELTA_PASS("instructions", reduceInstructionsDeltaPass) \
DELTA_PASS("operand-bundles", reduceOperandBundesDeltaPass) \
DELTA_PASS("attributes", reduceAttributesDeltaPass) \
- DELTA_PASS("module-inline-asm", reduceModuleInlineAsmDeltaPass)
+ DELTA_PASS("module-data", reduceModuleDataDeltaPass)
static void runAllDeltaPasses(TestRunner &Tester) {
#define DELTA_PASS(NAME, FUNC) FUNC(Tester);
--- /dev/null
+//===- ReduceModuleData.cpp -----------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements a reduce pass to reduce various module data.
+//
+//===----------------------------------------------------------------------===//
+
+#include "ReduceModuleData.h"
+
+using namespace llvm;
+
+static void clearModuleData(std::vector<Chunk> ChunksToKeep, Module *Program) {
+ Oracle O(ChunksToKeep);
+
+ if (!O.shouldKeep())
+ Program->setModuleIdentifier("");
+ if (!O.shouldKeep())
+ Program->setSourceFileName("");
+ if (!O.shouldKeep())
+ Program->setDataLayout("");
+ if (!O.shouldKeep())
+ Program->setTargetTriple("");
+ // TODO: clear line by line rather than all at once
+ if (!O.shouldKeep())
+ Program->setModuleInlineAsm("");
+}
+
+void llvm::reduceModuleDataDeltaPass(TestRunner &Test) {
+ outs() << "*** Reducing Module Data...\n";
+ runDeltaPass(Test, 5, clearModuleData);
+}
-//===- ReduceModuleInlineAsm.h --------------------------------------------===//
+//===- ReduceModuleData.h --------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_TOOLS_LLVM_REDUCE_DELTAS_REDUCE_MODULEINLINEASM_H
-#define LLVM_TOOLS_LLVM_REDUCE_DELTAS_REDUCE_MODULEINLINEASM_H
+#ifndef LLVM_TOOLS_LLVM_REDUCE_DELTAS_REDUCEMODULEDATA_H
+#define LLVM_TOOLS_LLVM_REDUCE_DELTAS_REDUCEMODULEDATA_H
#include "Delta.h"
namespace llvm {
-void reduceModuleInlineAsmDeltaPass(TestRunner &Test);
+void reduceModuleDataDeltaPass(TestRunner &Test);
} // namespace llvm
#endif
+++ /dev/null
-//===- ReduceModuleInlineAsm.cpp ------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements a function which calls the Generic Delta pass to reduce
-// module inline asm.
-//
-//===----------------------------------------------------------------------===//
-
-#include "ReduceModuleInlineAsm.h"
-#include "llvm/IR/Constants.h"
-#include "llvm/IR/GlobalValue.h"
-
-using namespace llvm;
-
-static void clearModuleInlineAsm(std::vector<Chunk> ChunksToKeep,
- Module *Program) {
- Oracle O(ChunksToKeep);
-
- // TODO: clear line by line rather than all at once
- if (!O.shouldKeep())
- Program->setModuleInlineAsm("");
-}
-
-void llvm::reduceModuleInlineAsmDeltaPass(TestRunner &Test) {
- outs() << "*** Reducing Module Inline Asm...\n";
- runDeltaPass(Test, 1, clearModuleInlineAsm);
-}
"deltas/ReduceGlobalVars.cpp",
"deltas/ReduceInstructions.cpp",
"deltas/ReduceMetadata.cpp",
- "deltas/ReduceModuleInlineAsm.cpp",
+ "deltas/ReduceModuleData.cpp",
"deltas/ReduceOperandBundles.cpp",
"deltas/ReduceSpecialGlobals.cpp",
"llvm-reduce.cpp",