[llvm-bugs] [Bug 33630] New: ThinLTO doesn't apply interprocedural ConstMerge

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jun 28 12:45:28 PDT 2017


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

            Bug ID: 33630
           Summary: ThinLTO doesn't apply interprocedural ConstMerge
           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 Constant Merging pass, but ThinLTO can't apply this
optimization right now.

Test case:

// a.c
const char *x = "blah";

// b.c
#include <stdio.h>

extern const char *x;
const char *b = "blah";

int main(void) {
  puts(x);
  puts(b);
}

//////////////////////

# == THINLTO ==
$ ../build/bin/clang a.c b.c --for-linker=-mllvm --for-linker=-stats -flto=thin
\
    -fuse-ld=lld -o out &>&1 | grep "constmerge"

# nothing

# == LTO ==
$ ../build/bin/clang a.c b.c --for-linker=-mllvm --for-linker=-stats -flto \
    -fuse-ld=lld -o out &>&1 | grep "constmerge"

  1 constmerge     - Number of global constants merged

-- 
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/20170628/ff64c2fc/attachment.html>


More information about the llvm-bugs mailing list