[PATCH] D85865: [ConstProp] Handle insertelement constants
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 13 12:11:53 PDT 2020
efriedma added inline comments.
================
Comment at: llvm/lib/IR/ConstantFold.cpp:858
+ if (const auto *IEIdx = dyn_cast<ConstantInt>(CE->getOperand(2))) {
+ if (IEIdx->equalsInt(CIdx->getZExtValue())) {
+ if (auto *IEValue = dyn_cast<Constant>(CE->getOperand(1)))
----------------
Oh, also, please avoid using getZExtValue() on constants that don't have a known width; it asserts the number is less than 2^64. Unfortunately, there isn't any convenient way to do this comparison at the moment; I guess you could use APSInt::isSameValue.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D85865/new/
https://reviews.llvm.org/D85865
More information about the llvm-commits
mailing list