1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00

[ConstantFold] Push extractelement into getelementptr's operands

This fixes a minor oversight mentioned in the review of D69379:
we should push extractelement into the operands of getelementptr
regardless of whether that enables further folding.
This commit is contained in:
Jay Foad 2019-10-29 10:31:52 +00:00
parent edca512d29
commit a5da59e9b1

View File

@ -808,7 +808,7 @@ Constant *llvm::ConstantFoldExtractElementInstruction(Constant *Val,
for (unsigned i = 0, e = CE->getNumOperands(); i != e; ++i) {
Constant *Op = CE->getOperand(i);
if (Op->getType()->isVectorTy()) {
Constant *ScalarOp = ConstantFoldExtractElementInstruction(Op, Idx);
Constant *ScalarOp = ConstantExpr::getExtractElement(Op, Idx);
if (!ScalarOp)
return nullptr;
Ops.push_back(ScalarOp);