[PATCH] D76664: [ConstantFold][NFC] Compile time optimization for large vectors
David Majnemer via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 23 19:37:04 PDT 2020
majnemer added inline comments.
================
Comment at: llvm/include/llvm/IR/Constants.h:770
+ : ConstantDataSequential(ty, ConstantDataVectorVal, Data) {
+ IsSplat = isSplatData(ty, Data);
+ }
----------------
I'd move this into the initializer.
================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:179
+ if (isa<ConstantAggregateZero>(Shuf->getMask())) {
+ DemandedLHS.setBit(0);
+ return true;
----------------
Is it OK to set DemandedLHS bit 0 when DemandedElts[0] is false?
================
Comment at: llvm/lib/IR/ConstantFold.cpp:64-67
+ if (Constant *Splat = CV->getSplatValue()) {
+ return ConstantVector::getSplat(DstTy->getVectorElementCount(),
+ ConstantExpr::getBitCast(Splat, DstEltTy));
+ }
----------------
Please add a comment for this.
================
Comment at: llvm/lib/IR/ConstantFold.cpp:891-896
+ if (isa<ConstantAggregateZero>(Mask) && !MaskEltCount.Scalable) {
+ Type *Ty = IntegerType::get(V1->getContext(), 32);
+ Constant *Elt =
+ ConstantExpr::getExtractElement(V1, ConstantInt::get(Ty, 0));
+ return ConstantVector::getSplat(MaskEltCount, Elt);
+ }
----------------
Please add a comment here.
================
Comment at: llvm/lib/IR/ConstantFold.cpp:1385-1386
+ if (C1Splat && C2Splat) {
+ if (Instruction::isIntDivRem(Opcode) && C2Splat->isNullValue())
+ return UndefValue::get(VTy);
+ return ConstantVector::getSplat(
----------------
This doesn't depend on `C1`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D76664/new/
https://reviews.llvm.org/D76664
More information about the llvm-commits
mailing list