<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - ARM miscompilation of store of global alias"
   href="https://llvm.org/bugs/show_bug.cgi?id=31896">31896</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>ARM miscompilation of store of global alias
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Backend: ARM
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>eugeni.stepanov@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>$ 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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>