http://llvm.org/bugs/show_bug.cgi?id=10484

           Summary: Lifetime markers are preventing alloca promotion
           Product: libraries
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


Created an attachment (id=6929)
 --> (http://llvm.org/bugs/attachment.cgi?id=6929)
Unoptimized bitcode for clang's Stmp.cpp

The llvm.lifetime markers inserted by the inliner are preventing allocas from
being promoted to registers.

This causes some functions to use a lot more stack space.

The attached example is from clang's own Stmt.cpp. The function
_ZNK5clang4Stmt14getSourceRangeEv has more then 50 allocas after optimizing to
file with 'opt -O2". If I apply this patch:

diff --git a/lib/Transforms/Utils/InlineFunction.cpp
b/lib/Transforms/Utils/InlineFunction.cpp
index 714b12c..c613d1a 100644
--- a/lib/Transforms/Utils/InlineFunction.cpp
+++ b/lib/Transforms/Utils/InlineFunction.cpp
@@ -934,7 +934,7 @@ bool llvm::InlineFunction(CallSite CS, InlineFunctionInfo
&IFI) {

   // Leave lifetime markers for the static alloca's, scoping them to the
   // function we just inlined.
-  if (!IFI.StaticAllocas.empty()) {
+  if (0 && !IFI.StaticAllocas.empty()) {
     IRBuilder<> builder(FirstNewBlock->begin());
     for (unsigned ai = 0, ae = IFI.StaticAllocas.size(); ai != ae; ++ai) {
       AllocaInst *AI = IFI.StaticAllocas[ai];

All of those allocas are optimized away.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to