<div dir="ltr"><div>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:</div><div><br></div><div>store <2 x i64> <i64 ptrtoint (... constant_pointer_value ... to i64), i64 0>, <2 x i64>* %f</div><div><br></div><div>ExecutionEngine would abort 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 that fixes that issue and works as intended from the limited scope of my project in case it is useful.</div><div><br></div><div>It certainly appears that this issue exists for other types besides Integer and for other aggregate constant types. Is there ExecutionEngine doesn't run the full-fledged getConstantValue on all subvalues of aggregate constants instead of reaching into / directly casting subvalues?</div><div><br></div><div>Bret Taylor</div><div><br></div></div>