[llvm-commits] [llvm] r102831 - in /llvm/trunk: lib/Transforms/IPO/Inliner.cpp test/Transforms/Inline/delete-call.ll

Chris Lattner clattner at apple.com
Sat May 1 10:21:24 PDT 2010


On May 1, 2010, at 1:34 AM, Owen Anderson wrote:

> Author: resistor
> Date: Sat May  1 03:34:28 2010
> New Revision: 102831
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=102831&view=rev
> Log:
> Disable the call-deletion transformation introduced in r86975.  Without
> halting analysis, it is illegal to delete a call to a read-only function.
> The correct solution is almost certainly to add a "must halt" attribute and
> only allow deletions in its presence.
> 
> XFAIL the relevant testcase for now.

This is not he right approach to solving this, so I reverted it.  If you'd like to talk about this, lets do.  There are several related open issues, please don't run around reverting random patches.

-Chris


> 
> Modified:
>    llvm/trunk/lib/Transforms/IPO/Inliner.cpp
>    llvm/trunk/test/Transforms/Inline/delete-call.ll
> 
> Modified: llvm/trunk/lib/Transforms/IPO/Inliner.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/Inliner.cpp?rev=102831&r1=102830&r2=102831&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/IPO/Inliner.cpp (original)
> +++ llvm/trunk/lib/Transforms/IPO/Inliner.cpp Sat May  1 03:34:28 2010
> @@ -33,7 +33,8 @@
> using namespace llvm;
> 
> STATISTIC(NumInlined, "Number of functions inlined");
> -STATISTIC(NumCallsDeleted, "Number of call sites deleted, not inlined");
> +// FIXME: Uncomment once call deletion xform is made safe
> +// STATISTIC(NumCallsDeleted, "Number of call sites deleted, not inlined");
> STATISTIC(NumDeleted, "Number of functions deleted because all callers found");
> STATISTIC(NumMergedAllocas, "Number of allocas merged together");
> 
> @@ -382,6 +383,9 @@
>       Function *Caller = CS.getCaller();
>       Function *Callee = CS.getCalledFunction();
> 
> +      // FIXME: This transformation is not legal unless we can prove
> +      // that the callee always terminates.
> +#if 0
>       // If this call site is dead and it is to a readonly function, we should
>       // just delete the call instead of trying to inline it, regardless of
>       // size.  This happens because IPSCCP propagates the result out of the
> @@ -396,6 +400,7 @@
>         // Update the cached cost info with the missing call
>         growCachedCostInfo(Caller, NULL);
>       } else {
> +#endif
>         // We can only inline direct calls to non-declarations.
>         if (Callee == 0 || Callee->isDeclaration()) continue;
> 
> @@ -437,7 +442,9 @@
> 
>         // Update the cached cost info with the inlined call.
>         growCachedCostInfo(Caller, Callee);
> +#if 0
>       }
> +#endif
> 
>       // If we inlined or deleted the last possible call site to the function,
>       // delete the function body now.
> 
> Modified: llvm/trunk/test/Transforms/Inline/delete-call.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Inline/delete-call.ll?rev=102831&r1=102830&r2=102831&view=diff
> ==============================================================================
> --- llvm/trunk/test/Transforms/Inline/delete-call.ll (original)
> +++ llvm/trunk/test/Transforms/Inline/delete-call.ll Sat May  1 03:34:28 2010
> @@ -1,6 +1,6 @@
> ; RUN: opt %s -S  -inline -functionattrs -stats |& grep {Number of call sites deleted, not inlined}
> ; RUN: opt %s -S  -inline -stats |& grep {Number of functions inlined}
> -
> +; XFAIL: *
> target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32"
> target triple = "i386-apple-darwin9.8"
> 
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits





More information about the llvm-commits mailing list