<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 --- - Regression: ARM jump table miscompilation" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D23627&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=TJEJOVsNzhzqWN8Tm_RpbTKGTEoc3tKyj75zOflXtCo&s=p4FV4AgpTx4I904ew_xuM9YdLVewY0M0VZGJr4wa504&e=">23627</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Regression: ARM jump table miscompilation
          </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>peter@pcc.me.uk
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=14366" name="attach_14366" title="source">attachment 14366</a> <a href="attachment.cgi?id=14366&action=edit" title="source">[details]</a></span>
source

Given the attached hist.cc, after reverting r237972:

$ clang -march=armv7-a -mtune=generic-armv7-a -mfpu=vfpv3-d16
-mfloat-abi=softfp -mthumb -target arm-linux-androideabi -Oz  
-fomit-frame-pointer  -fno-exceptions -fno-rtti -fno-threadsafe-statics
-std=gnu++11 -S -w hist.cc

produces the attached hist.s. The miscompiled code starts on line 564:

@ BB#26:
        adr.w   r0, .LJTI1_0
        add.w   r0, r0, r1, lsl #2
.LCPI1_48:
        tbh     [r0, r1, lsl #1]
        .align  2
@ BB#27:
.LCPI1_49:
        .long   600000                  @ 0x927c0
@ BB#28:
.LJTI1_0:
        .short  (.LBB1_29-(.LCPI1_48+4))/2
        .short  (.LBB1_32-(.LCPI1_48+4))/2
        .short  (.LBB1_42-(.LCPI1_48+4))/2
        .short  (.LBB1_38-(.LCPI1_48+4))/2
        .short  (.LBB1_41-(.LCPI1_48+4))/2

In this code the tbh instruction ends up loading from .LJTI_0 + (r1 << 2) + (r1
<< 1) instead of the intended .LJTI0 + (r1 << 1).</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>