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

           Summary: Duplicate strings
           Product: clang
           Version: 2.9
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]


In a simple program with duplicate strings in printf, clang creates two
identical string constants:

#include <stdio.h>

void gp2() {
  printf("hello\n");
  printf("hello\n");
}

The bitcode file has two different string constants.

The x86 code generator removes the duplicate but in both Arm and Mips the
duplicate is preserved.


    .file    "gp2.c"
    .text
    .globl    gp2
    .align    16, 0x90
    .type    gp2,@function
gp2:                                    # @gp2
.Ltmp2:
    .cfi_startproc
# BB#0:                                 # %entry
    pushq    %rbp
.Ltmp3:
    .cfi_def_cfa_offset 16
.Ltmp4:
    .cfi_offset %rbp, -16
    movq    %rsp, %rbp
.Ltmp5:
    .cfi_def_cfa_register %rbp
    movl    $str, %edi
    callq    puts
    movl    $str1, %edi
    popq    %rbp
    jmp    puts                    # TAILCALL
.Ltmp6:
    .size    gp2, .Ltmp6-gp2
.Ltmp7:
    .cfi_endproc
.Leh_func_end0:

    .type    str,@object             # @str
    .section    .rodata,"a",@progbits
str:
    .asciz     "hello"
    .size    str, 6

    .type    str1,@object            # @str1
str1:
    .asciz     "hello"
    .size    str1, 6


    .section    ".note.GNU-stack","",@progbits

-- 
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