[llvm] r290572 - [PM] Teach the inliner in the new PM to merge attributes after inlining.

Chandler Carruth via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 26 19:39:54 PST 2016


Author: chandlerc
Date: Mon Dec 26 21:39:54 2016
New Revision: 290572

URL: http://llvm.org/viewvc/llvm-project?rev=290572&view=rev
Log:
[PM] Teach the inliner in the new PM to merge attributes after inlining.

Also enable the new PM in the attributes test case which caught this
issue.

Modified:
    llvm/trunk/lib/Transforms/IPO/Inliner.cpp
    llvm/trunk/test/Transforms/Inline/attributes.ll

Modified: llvm/trunk/lib/Transforms/IPO/Inliner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/Inliner.cpp?rev=290572&r1=290571&r2=290572&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/Inliner.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/Inliner.cpp Mon Dec 26 21:39:54 2016
@@ -842,6 +842,9 @@ PreservedAnalyses InlinerPass::run(LazyC
           if (!NewCallee->isDeclaration())
             Calls.push_back(CS);
 
+      // Merge the attributes based on the inlining.
+      AttributeFuncs::mergeAttributesForInlining(F, Callee);
+
       // For local functions, check whether this makes the callee trivially
       // dead. In that case, we can drop the body of the function eagerly
       // which may reduce the number of callers of other functions to one,

Modified: llvm/trunk/test/Transforms/Inline/attributes.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Inline/attributes.ll?rev=290572&r1=290571&r2=290572&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/Inline/attributes.ll (original)
+++ llvm/trunk/test/Transforms/Inline/attributes.ll Mon Dec 26 21:39:54 2016
@@ -1,4 +1,5 @@
 ; RUN: opt < %s -inline -S | FileCheck %s
+; RUN: opt < %s -passes='cgscc(inline)' -S | FileCheck %s
 target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
 
 define i32 @noattr_callee(i32 %i) {
@@ -305,4 +306,4 @@ define i32 @test_no-use-jump-tables3(i32
 ; CHECK: attributes [[FPMAD_FALSE]] = { "less-precise-fpmad"="false" }
 ; CHECK: attributes [[FPMAD_TRUE]] = { "less-precise-fpmad"="true" }
 ; CHECK: attributes [[NOIMPLICITFLOAT]] = { noimplicitfloat }
-; CHECK: attributes [[NOUSEJUMPTABLES]] = { "no-jump-tables"="true" }
\ No newline at end of file
+; CHECK: attributes [[NOUSEJUMPTABLES]] = { "no-jump-tables"="true" }




More information about the llvm-commits mailing list