[llvm-bugs] [Bug 33645] New: ThinLTO doesn't apply interprocedural ArgumentPromotion optimization

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jun 29 09:12:18 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=33645

            Bug ID: 33645
           Summary: ThinLTO doesn't apply interprocedural
                    ArgumentPromotion optimization
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Interprocedural Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: charles.saternos at gmail.com
                CC: llvm-bugs at lists.llvm.org

LTO will apply the Argument Promotion pass, but ThinLTO can't apply this
optimization right now.

Test case:

$ cat a.cc
__attribute__((noinline))
int f(const int *x) {
    int k = *x;
    return k + 1;
}

$ cat b.cc
#include <stdio.h>

extern int f(const int *x);

int main(void) {
  int x = 3;
  printf("%d\n", f(&x));
}

$ ../build/bin/clang++ a.cc b.cc -O3 --for-linker=-mllvm --for-linker=-stats
-flto=thin -fuse-ld=lld -o thin &>&1 | grep argpromotion
# nothing
$ ../build/bin/clang++ a.cc b.cc -O3 --for-linker=-mllvm --for-linker=-stats
-flto -fuse-ld=lld -o lto &>&1 | grep argpromotion
   1 argpromotion          - Number of pointer arguments promoted

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170629/85d07390/attachment.html>


More information about the llvm-bugs mailing list