[llvm] b12176d - Revert "[llvm-reduce] add ReduceAttribute delta pass"

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 5 11:15:52 PST 2020


Author: Nico Weber
Date: 2020-02-05T14:15:11-05:00
New Revision: b12176d2aafa0ccb2585aa218fc3b454ba84f2a9

URL: https://github.com/llvm/llvm-project/commit/b12176d2aafa0ccb2585aa218fc3b454ba84f2a9
DIFF: https://github.com/llvm/llvm-project/commit/b12176d2aafa0ccb2585aa218fc3b454ba84f2a9.diff

LOG: Revert "[llvm-reduce] add ReduceAttribute delta pass"

This reverts commit fc62b36a000681c01e993242b583c5ec4ab48a3c.
Breaks tests on mac: http://45.33.8.238/mac/7301/step_11.txt

Added: 
    

Modified: 
    llvm/tools/llvm-reduce/CMakeLists.txt
    llvm/tools/llvm-reduce/DeltaManager.h
    llvm/tools/llvm-reduce/deltas/ReduceInstructions.cpp

Removed: 
    llvm/test/Reduce/Inputs/remove-attributes.py
    llvm/test/Reduce/remove-attributes.ll
    llvm/tools/llvm-reduce/deltas/ReduceAttributes.cpp
    llvm/tools/llvm-reduce/deltas/ReduceAttributes.h


################################################################################
diff  --git a/llvm/test/Reduce/Inputs/remove-attributes.py b/llvm/test/Reduce/Inputs/remove-attributes.py
deleted file mode 100755
index af76dd4ba6b6..000000000000
--- a/llvm/test/Reduce/Inputs/remove-attributes.py
+++ /dev/null
@@ -1,7 +0,0 @@
-import sys
-
-for line in open(sys.argv[1], "r"):
-  if "use-soft-float" in line:
-    sys.exit(0) # Interesting!
-
-sys.exit(1)

diff  --git a/llvm/test/Reduce/remove-attributes.ll b/llvm/test/Reduce/remove-attributes.ll
deleted file mode 100644
index 4dc6ea168ba0..000000000000
--- a/llvm/test/Reduce/remove-attributes.ll
+++ /dev/null
@@ -1,16 +0,0 @@
-; Test that llvm-reduce can remove uninteresting attributes.
-;
-; RUN: rm -rf %t
-; RUN: llvm-reduce --test %python --test-arg %p/Inputs/remove-attributes.py %s -o %t
-; RUN: cat %t | FileCheck  %s
-
-define void @a() #0 {
-  ret void
-}
-define void @b() #1 {
-  ret void
-}
-
-; CHECK: attributes #0 = { "use-soft-float"="false" }
-attributes #0 = { norecurse noreturn nounwind readnone uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "patchable-function-entry"="2" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
-attributes #1 = { norecurse }

diff  --git a/llvm/tools/llvm-reduce/CMakeLists.txt b/llvm/tools/llvm-reduce/CMakeLists.txt
index 359626f70ccc..48de0ffa78a1 100644
--- a/llvm/tools/llvm-reduce/CMakeLists.txt
+++ b/llvm/tools/llvm-reduce/CMakeLists.txt
@@ -14,13 +14,12 @@ add_llvm_tool(llvm-reduce
   llvm-reduce.cpp
   TestRunner.cpp
   deltas/Delta.cpp
-  deltas/ReduceArguments.cpp
-  deltas/ReduceAttributes.cpp
-  deltas/ReduceBasicBlocks.cpp
   deltas/ReduceFunctions.cpp
   deltas/ReduceGlobalVars.cpp
-  deltas/ReduceInstructions.cpp
   deltas/ReduceMetadata.cpp
+  deltas/ReduceArguments.cpp
+  deltas/ReduceBasicBlocks.cpp
+  deltas/ReduceInstructions.cpp
 
   DEPENDS
   intrinsics_gen

diff  --git a/llvm/tools/llvm-reduce/DeltaManager.h b/llvm/tools/llvm-reduce/DeltaManager.h
index 595f13005da2..2309c3adf4e6 100644
--- a/llvm/tools/llvm-reduce/DeltaManager.h
+++ b/llvm/tools/llvm-reduce/DeltaManager.h
@@ -14,12 +14,11 @@
 #include "TestRunner.h"
 #include "deltas/Delta.h"
 #include "deltas/ReduceArguments.h"
-#include "deltas/ReduceAttributes.h"
 #include "deltas/ReduceBasicBlocks.h"
 #include "deltas/ReduceFunctions.h"
 #include "deltas/ReduceGlobalVars.h"
-#include "deltas/ReduceInstructions.h"
 #include "deltas/ReduceMetadata.h"
+#include "deltas/ReduceInstructions.h"
 
 namespace llvm {
 
@@ -31,7 +30,6 @@ inline void runDeltaPasses(TestRunner &Tester) {
   reduceMetadataDeltaPass(Tester);
   reduceArgumentsDeltaPass(Tester);
   reduceInstructionsDeltaPass(Tester);
-  reduceAttributesDeltaPass(Tester);
   // TODO: Implement the remaining Delta Passes
 }
 

diff  --git a/llvm/tools/llvm-reduce/deltas/ReduceAttributes.cpp b/llvm/tools/llvm-reduce/deltas/ReduceAttributes.cpp
deleted file mode 100644
index ac8e0be58313..000000000000
--- a/llvm/tools/llvm-reduce/deltas/ReduceAttributes.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-//===- ReduceAttributes.cpp - Specialized Delta Pass ----------------------===//
-//
-// 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 in order
-// to reduce Attributes in the provided Module.
-//
-//===----------------------------------------------------------------------===//
-
-#include "ReduceAttributes.h"
-
-#include "Delta.h"
-#include "TestRunner.h"
-
-#include "llvm/IR/Attributes.h"
-#include "llvm/IR/Function.h"
-#include "llvm/IR/Module.h"
-
-#include <vector>
-
-static void removeAttr(llvm::Function &F, const llvm::Attribute &A) {
-  if (A.isStringAttribute())
-    F.removeFnAttr(A.getKindAsString());
-  else
-    F.removeFnAttr(A.getKindAsEnum());
-}
-
-static void extractAttributes(const std::vector<llvm::Chunk> &ChunksToKeep,
-                              llvm::Module *M) {
-  int AttributeIndex = 0;
-  unsigned ChunkIndex = 0;
-  // TODO: global variables may also have attributes.
-  for (llvm::Function &F : M->getFunctionList()) {
-    for (const llvm::Attribute &A : F.getAttributes().getFnAttributes()) {
-      ++AttributeIndex;
-      if (!ChunksToKeep[ChunkIndex].contains(AttributeIndex))
-        removeAttr(F, A);
-      if (AttributeIndex == ChunksToKeep[ChunkIndex].end)
-        ++ChunkIndex;
-    }
-  }
-}
-
-static int countAttributes(llvm::Module *M) {
-  int TotalAttributeCount = 0;
-  for (const llvm::Function &F : M->getFunctionList())
-    TotalAttributeCount +=
-        F.getAttributes().getFnAttributes().getNumAttributes();
-  // TODO: global variables may also have attributes.
-  return TotalAttributeCount;
-}
-
-void llvm::reduceAttributesDeltaPass(TestRunner &Test) {
-  outs() << "*** Reducing Attributes...\n";
-  int AttributeCount = countAttributes(Test.getProgram());
-  runDeltaPass(Test, AttributeCount, extractAttributes);
-}

diff  --git a/llvm/tools/llvm-reduce/deltas/ReduceAttributes.h b/llvm/tools/llvm-reduce/deltas/ReduceAttributes.h
deleted file mode 100644
index 1a20a2bc8b54..000000000000
--- a/llvm/tools/llvm-reduce/deltas/ReduceAttributes.h
+++ /dev/null
@@ -1,18 +0,0 @@
-//===- ReduceAttributes.h - Specialized Delta Pass ------------------------===//
-//
-// 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 in order
-// to reduce Attributes in the provided Module.
-//
-//===----------------------------------------------------------------------===//
-
-#include "TestRunner.h"
-
-namespace llvm {
-void reduceAttributesDeltaPass(TestRunner &Test);
-} // namespace llvm

diff  --git a/llvm/tools/llvm-reduce/deltas/ReduceInstructions.cpp b/llvm/tools/llvm-reduce/deltas/ReduceInstructions.cpp
index 6fe10dcb15d2..b3497ad2dc02 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceInstructions.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceInstructions.cpp
@@ -59,7 +59,7 @@ static unsigned countInstructions(Module *Program) {
 }
 
 void llvm::reduceInstructionsDeltaPass(TestRunner &Test) {
-  outs() << "*** Reducing Instructions...\n";
+  outs() << "*** Reducing Insructions...\n";
   unsigned InstCount = countInstructions(Test.getProgram());
   runDeltaPass(Test, InstCount, extractInstrFromModule);
 }


        


More information about the llvm-commits mailing list