[PATCH] Update call graph after devirtualizing returned value

pete.cooper at gmail.com pete.cooper at gmail.com
Tue Jun 3 17:17:08 PDT 2014


Hi chandlerc,

This patch is part of a series which ultimately allows us to splice the last use of a callee instead of clone it.  The other patches are ready but i'd like to get this done first.

This patch updates the call graph whenever the inliner devirtualizes a call based on a returned value.

That is, if we have the following, then after @f1 is inlined, the call to % funcall1_ actually points to @f2.  The inliner will currently proceed with inlining @f2 but with out of date call graph information.

define i32 @test1() {
  %funcall1_ = call fastcc i32 ()* ()* @f1()
  %executecommandptr1_ = call i32 %funcall1_()
  ret i32 %executecommandptr1_
}

define internal fastcc i32 ()* @f1() nounwind readnone {
  ret i32 ()* @f2
}

define internal i32 @f2() nounwind readnone {
  ret i32 1
}

http://reviews.llvm.org/D4012

Files:
  lib/Transforms/IPO/Inliner.cpp
  lib/Transforms/Utils/InlineFunction.cpp
  test/Transforms/Inline/devirtualize-2.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4012.10071.patch
Type: text/x-patch
Size: 7389 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140604/52ed4160/attachment.bin>


More information about the llvm-commits mailing list