[PATCH] D82061: [IR] Prefer scalar type for struct indexes in GEP constant expressions.
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 19 11:26:53 PDT 2020
efriedma marked an inline comment as done.
efriedma added inline comments.
================
Comment at: llvm/lib/IR/Constants.cpp:2192
+ !Idx->getType()->isVectorTy()) {
Idx = ConstantVector::getSplat(EltCount, Idx);
+ }
----------------
sdesmalen wrote:
> What is the reason for not always using a scalar index value?
In my thinking, there are two reasons:
1. I wanted to be conservative; arbitrary constant expressions are legal in this position anyway, so the harm from code failing to understand a vector splat is much smaller.
2. We don't want to accidentally change the result type of a GEP if every operand is a splat.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D82061/new/
https://reviews.llvm.org/D82061
More information about the llvm-commits
mailing list