aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib
diff options
context:
space:
mode:
authorJay Foad <jay.foad@amd.com>2019-10-29 10:31:52 +0000
committerJay Foad <jay.foad@amd.com>2019-10-29 10:31:52 +0000
commitdc63d6175aa5692db1670dc9ee7a1f304e752d87 (patch)
treeafa0c677f17f1e1e135e263ddda67687fcee230a /llvm/lib
parentf821ab807debdc973066ea43ac23173ef08dc2f5 (diff)
downloadllvm-dc63d6175aa5692db1670dc9ee7a1f304e752d87.zip
llvm-dc63d6175aa5692db1670dc9ee7a1f304e752d87.tar.gz
llvm-dc63d6175aa5692db1670dc9ee7a1f304e752d87.tar.bz2
[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.
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/IR/ConstantFold.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp
index 84b117d..a6cd833 100644
--- a/llvm/lib/IR/ConstantFold.cpp
+++ b/llvm/lib/IR/ConstantFold.cpp
@@ -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);