Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
this causes crashes on
$ /tmp/a.ll target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" define void @f() { entry: %cmp.i.i.i = fcmp olt x86_fp80 0xK00000000000000000000, 0xK00000000000000000000 %cmp.i6.i.i = fcmp olt x86_fp80 0xK00000000000000000000, 0xK00000000000000000000 ret void } $ opt -p slp-vectorizer -disable-output /tmp/a.ll
I've reverted this for now
Reverted this again. Please make sure that reviews and commit messages always have a meaningful description.
This change doesn't make sense in isolation, and neither the patch nor the commit include the necessary larger context that could justify this change.
@aeubanks @nikic I will not add this in the commit message. It is too long.
Let's say we have a IR like this
%in1 = getelementptr inbounds i32, ptr %in0, i64 1 %in2 = getelementptr inbounds i32, ptr %in0, i64 2 %in3 = getelementptr inbounds i32, ptr %in0, i64 3 %v0 = load i32, ptr %in0, align 4 %v1 = load i32, ptr %in1, align 4 %v2 = load i32, ptr %in2, align 4 %v3 = load i32, ptr %in3, align 4
SLP can make this into load <4 x i32>, ptr %in0, align 4. Using FixedVectorType::get(i32, 4) works well.
For revec, we have a IR like this
%in1 = getelementptr inbounds i32, ptr %in0, i64 4 %in2 = getelementptr inbounds i32, ptr %in0, i64 8 %in3 = getelementptr inbounds i32, ptr %in0, i64 12 %v0 = load <4 x i32>, ptr %in0, align 4 %v1 = load <4 x i32>, ptr %in1, align 4 %v2 = load <4 x i32>, ptr %in2, align 4 %v3 = load <4 x i32>, ptr %in3, align 4
SLP can make this into load <16 x i32>, ptr %in0, align 4. But using FixedVectorType::get(<4 x i32>, 4) is incorrect. The actually function call should be FixedVectorType::get(i32, 16).
To make scalar to vector and vector to vector work together, you need
unsigned NumElements = 1; if (auto *VecTy = dyn_cast<FixedVectorType>(ScalarTy)) NumElements = VecTy->getNumElements(); FixedVectorType *VecTy = FixedVectorType::get(ScalarTy->getScalarType(), VF * NumElements);
If FixedVectorType::get occurs only few times, do in this way is better. But the fact is we need a function to wrap it.
Here is how your patch description could have looked like:
In the future, we want to support ScalarTy being a vector, which is extended to a VectorTy with more elements. To allow making that change in a central place, introduce a makeScalarTyToVectorTy() helper.
Is that an accurate summary of the motivation?
Maybe together with a note:
This is part up an effort to upstream revec support.
If that is what you're doing.
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | ||
---|---|---|
1082 | my 2 cents Based on recent comment this is going to be extended to handle vector type as well. In this regard name of the function is not going to sound accurate for its purpose. and perhaps place it into |
clang-format not found in user’s local PATH; not linting file.