<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 --- - GVN ignores inbounds of getelementptr"
   href="https://llvm.org/bugs/show_bug.cgi?id=28562">28562</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>GVN ignores inbounds of getelementptr
          </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>Scalar Optimizations
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>kyoonss@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>david.majnemer@gmail.com, dberlin@dberlin.org, listmail@philipreames.com, llvm-bugs@lists.llvm.org, nunoplopes@sapo.pt, sanjoy@playingwithpointers.com
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>GVN ignores the inbounds keyword of getelementptr instructions.

As a consequence, it may replace a GEP instruction without inbounds with
another GEP with inbounds.

Running 'opt -gvn' for the source code below produces the following result:


source:

define i32* @foo(i32* %a) {
  %x1 = getelementptr inbounds i32, i32* %a, i32 10
  %x2 = getelementptr i32, i32* %a, i32 10
  ret i32* %x2
}

result:

define i32* @foo(i32* %a) {
  %x1 = getelementptr inbounds i32, i32* %a, i32 10
  ret i32* %x1
}


I think foo's behavior is changed, since the GEP with inbounds can be a poison
value.</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>