[PATCH] D115387: [instcombine] Canonicalize constant index type to i64 for extractelement/insertelement
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 9 00:14:49 PST 2021
nikic added a comment.
Okay, in that case this looks good to me, we don't seem to have any clearly preferred type here. Given the test churn, waiting for a second opinion would be good.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp:382
+ auto *NewIdx = IndexBW < 64 ? ConstantExpr::getZExt(IndexC, I64) :
+ ConstantExpr::getTrunc(IndexC, I64);
+ return replaceOperand(EI, 1, NewIdx);
----------------
Something like `auto *NewIdx = ConstantInt::get(IndexC->getContext(), IndexC->getValue().zextOrTrunc(64))` might be more elegant?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115387/new/
https://reviews.llvm.org/D115387
More information about the llvm-commits
mailing list