[PATCH] Enable constant expressions in vector constants

Bret Taylor via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 3 15:28:20 PST 2016


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 would assert 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. This patch fixes that issue and works as intended from the
limited scope of my project.

Though it certainly appears that this issue exists for other types besides
Integer and for other aggregate constant types, I purposely kept my patch
small given my limited exposure to LLVM internals.

Bret Taylor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160103/966b4c29/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vector-constant-expressions.patch
Type: application/octet-stream
Size: 1212 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160103/966b4c29/attachment.obj>


More information about the llvm-commits mailing list