[llvm-bugs] [Bug 31896] New: ARM miscompilation of store of global alias

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Feb 7 15:49:43 PST 2017


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

            Bug ID: 31896
           Summary: ARM miscompilation of store of global alias
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: ARM
          Assignee: unassignedbugs at nondot.org
          Reporter: eugeni.stepanov at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

$ cat q.ll
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
target triple = "thumbv7--linux"

@X = constant {i8, i8 } { i8 0, i8 0 }
@XA = alias i8, getelementptr inbounds ({ i8, i8 }, {i8, i8}* @X, i32 0, i32 0)
@XB = alias i8, getelementptr inbounds ({ i8, i8 }, {i8, i8}* @X, i32 0, i32 1)

; not using alias - OK
define void @zzz(i8** %p) align 2 {
entry:
  store i8* getelementptr inbounds ({ i8, i8 }, {i8, i8}* @X, i32 0, i32 1), i8
**%p, align 4
  ret void
}

; store by alias. zzzA and zzzB generate identical code.
define void @zzzA(i8** %p) align 2 {
entry:
  store i8* @XA, i8 **%p, align 4
  ret void
}

define void @zzzB(i8** %p) align 2 {
entry:
  store i8* @XB, i8 **%p, align 4
  ret void
}

$ bin/llc q.ll -o -
zzz:
    .fnstart
@ BB#0:                                 @ %entry
    movw    r1, :lower16:X
    movt    r1, :upper16:X
    adds    r1, #1
    str    r1, [r0]
    bx    lr

zzzA:
    .fnstart
@ BB#0:                                 @ %entry
    movw    r1, :lower16:X
    movt    r1, :upper16:X
    str    r1, [r0]
    bx    lr

zzzB:
    .fnstart
@ BB#0:                                 @ %entry
    movw    r1, :lower16:X
    movt    r1, :upper16:X
    str    r1, [r0]
    bx    lr

Note how @XA and @XB are different, but assembly for @zzzA and @zzzB is the
same.

-- 
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/20170207/1f4929f5/attachment-0001.html>


More information about the llvm-bugs mailing list