[PATCH] D14001: [Inliner] Don't inline through callsites with operand bundles

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 22 17:28:21 PDT 2015


sanjoy created this revision.
sanjoy added reviewers: reames, chandlerc, majnemer.
sanjoy added a subscriber: llvm-commits.

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.

http://reviews.llvm.org/D14001

Files:
  lib/Transforms/Utils/InlineFunction.cpp
  test/Feature/OperandBundles/inliner-conservative.ll

Index: test/Feature/OperandBundles/inliner-conservative.ll
===================================================================
--- /dev/null
+++ test/Feature/OperandBundles/inliner-conservative.ll
@@ -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
+}
Index: lib/Transforms/Utils/InlineFunction.cpp
===================================================================
--- lib/Transforms/Utils/InlineFunction.cpp
+++ lib/Transforms/Utils/InlineFunction.cpp
@@ -1029,6 +1029,10 @@
       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();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14001.38190.patch
Type: text/x-patch
Size: 1207 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151023/4db1c2ca/attachment.bin>


More information about the llvm-commits mailing list