[llvm] r251141 - [Inliner] Don't inline through callsites with operand bundles
Sanjoy Das via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 23 13:09:55 PDT 2015
Author: sanjoy
Date: Fri Oct 23 15:09:55 2015
New Revision: 251141
URL: http://llvm.org/viewvc/llvm-project?rev=251141&view=rev
Log:
[Inliner] Don't inline through callsites with operand bundles
Summary:
This change teaches the LLVM inliner to not inline through callsites
with unknown operand bundles. Currently all operand bundles are
"unknown" operand bundles but in the near future we will add support for
inlining through some select kinds of operand bundles.
Reviewers: reames, chandlerc, majnemer
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D14001
Added:
llvm/trunk/test/Feature/OperandBundles/inliner-conservative.ll
Modified:
llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
Modified: llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp?rev=251141&r1=251140&r2=251141&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp Fri Oct 23 15:09:55 2015
@@ -1029,6 +1029,10 @@ bool llvm::InlineFunction(CallSite CS, I
CalledFunc->isDeclaration() || // call, or call to a vararg function!
CalledFunc->getFunctionType()->isVarArg()) return false;
+ // The inliner does not know how to inline through calls with operand bundles.
+ if (CS.hasOperandBundles())
+ return false;
+
// If the call to the callee cannot throw, set the 'nounwind' flag on any
// calls that we inline.
bool MarkNoUnwind = CS.doesNotThrow();
Added: llvm/trunk/test/Feature/OperandBundles/inliner-conservative.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Feature/OperandBundles/inliner-conservative.ll?rev=251141&view=auto
==============================================================================
--- llvm/trunk/test/Feature/OperandBundles/inliner-conservative.ll (added)
+++ llvm/trunk/test/Feature/OperandBundles/inliner-conservative.ll Fri Oct 23 15:09:55 2015
@@ -0,0 +1,17 @@
+; RUN: opt -S -inline < %s | FileCheck %s
+
+; Check that the inliner does not inline through arbitrary unknown
+; operand bundles.
+
+define i32 @callee() {
+ entry:
+ ret i32 2
+}
+
+define i32 @caller() {
+; CHECK: @caller(
+ entry:
+; CHECK: call i32 @callee() [ "unknown"() ]
+ %x = call i32 @callee() [ "unknown"() ]
+ ret i32 %x
+}
More information about the llvm-commits
mailing list