<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 --- - Constant vectors do not support ConstantExprs"
   href="https://llvm.org/bugs/show_bug.cgi?id=26026">26026</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Constant vectors do not support ConstantExprs
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </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>Interpreter
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>btaylor@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>Created <span class=""><a href="attachment.cgi?id=15558" name="attach_15558" title="Patch to enable ConsantExpr evaluation for constant vectors">attachment 15558</a> <a href="attachment.cgi?id=15558&action=edit" title="Patch to enable ConsantExpr evaluation for constant vectors">[details]</a></span>
Patch to enable ConsantExpr evaluation for constant vectors

I am working on a project that uses integer vectors fairly extensively. Some
values in the vectors came from constant pointers cast to 64-bit integers, and
the LLVM optimizer would often end up folding values into instructions that
looked like this:

store <2 x i64> <i64 ptrtoint (... constant_pointer_value ... to i64), i64 0>,
<2 x i64>* %f

ExecutionEngine aborts at runtime on all instructions like this because
ExecutionEngine::getConstantValue assumes all vector constants are "simple
constants" whose values are ConstantInts, not handling the case of
ConstantExpr.

I attached a patch, which you can also see in my git branch here -
<a href="https://github.com/finiteloop/llvm/commit/a7ad5bdbbab509d2a7d8c5af35e436e2b72730c4">https://github.com/finiteloop/llvm/commit/a7ad5bdbbab509d2a7d8c5af35e436e2b72730c4</a></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>