[llvm] r227724 - [PM] Teach the module-to-function adaptor to not run function passes

Chandler Carruth chandlerc at gmail.com
Sun Feb 1 02:47:25 PST 2015


Author: chandlerc
Date: Sun Feb  1 04:47:25 2015
New Revision: 227724

URL: http://llvm.org/viewvc/llvm-project?rev=227724&view=rev
Log:
[PM] Teach the module-to-function adaptor to not run function passes
over declarations.

This is both quite unproductive and causes things to crash, for example
domtree would just assert.

I've added a declaration and a domtree run to the basic high-level tests
for the new pass manager.

Modified:
    llvm/trunk/include/llvm/IR/PassManager.h
    llvm/trunk/test/Other/new-pass-manager.ll

Modified: llvm/trunk/include/llvm/IR/PassManager.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/PassManager.h?rev=227724&r1=227723&r2=227724&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/PassManager.h (original)
+++ llvm/trunk/include/llvm/IR/PassManager.h Sun Feb  1 04:47:25 2015
@@ -783,6 +783,9 @@ public:
 
     PreservedAnalyses PA = PreservedAnalyses::all();
     for (Function &F : M) {
+      if (F.isDeclaration())
+        continue;
+
       PreservedAnalyses PassPA = Pass.run(F, FAM);
 
       // We know that the function pass couldn't have invalidated any other

Modified: llvm/trunk/test/Other/new-pass-manager.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Other/new-pass-manager.ll?rev=227724&r1=227723&r2=227724&view=diff
==============================================================================
--- llvm/trunk/test/Other/new-pass-manager.ll (original)
+++ llvm/trunk/test/Other/new-pass-manager.ll Sun Feb  1 04:47:25 2015
@@ -290,6 +290,16 @@
 ; CHECK-TIRA-NOT: Running analysis: TargetIRAnalysis
 ; CHECK-TIRA: Finished pass manager
 
+; RUN: opt -disable-output -disable-verify -debug-pass-manager %s 2>&1 \
+; RUN:     -passes='require<domtree>' \
+; RUN:     | FileCheck %s --check-prefix=CHECK-DT
+; CHECK-DT: Starting pass manager
+; CHECK-DT: Running pass: RequireAnalysisPass
+; CHECK-DT: Running analysis: DominatorTreeAnalysis
+; CHECK-DT: Finished pass manager
+
 define void @foo() {
   ret void
 }
+
+declare void @bar()





More information about the llvm-commits mailing list