Bail out early for scalable vectors. As global variables are not expected
to be scalable.
Use explicit call of getFixedSize() to assert on places where scalable size
doesn't make sense.
Differential D74424
[ConstantFold][SVE] Fix constant fold for FoldReinterpretLoadFromConstPtr. huihuiz on Feb 11 2020, 10:39 AM. Authored by
Details Bail out early for scalable vectors. As global variables are not expected Use explicit call of getFixedSize() to assert on places where scalable size
Diff Detail
Event TimelineComment Actions Current upstream crash with : include/llvm/Support/TypeSize.h:126: uint64_t llvm::TypeSize::getFixedSize() const: Assertion `!IsScalable && "Request for a fixed size on a scalable object"' failed. test.ll define <vscale x 2 x double> @load() { %r = load <vscale x 2 x double>, <vscale x 2 x double>* getelementptr (<vscale x 2 x double>, <vscale x 2 x double>* null, i64 1) ret <vscale x 2 x double> %r } run: opt -S -constprop test.ll -o -
|
It seems a bit arbitrary to special case this condition, given that the remainder of the function also doesn't work for scalable vectors (scalable vectors cannot be global variables according to the LangRef).
It probably makes more sense to bail out at the beginning of this function and to query the fixed-size explicit using getTypeSizeInBits().getFixed().