[llvm] 81b42ca - [Hexagon] Handle opaque pointers in vector combine
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 12 16:32:37 PDT 2021
Any chance of adding testing something like the way
https://reviews.llvm.org/D105398 includes testing? (maybe an existing
test that could just get a new RUN line that forces opaque pointers?)
On Fri, Jul 2, 2021 at 11:08 AM Krzysztof Parzyszek via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
>
>
> Author: Krzysztof Parzyszek
> Date: 2021-07-02T13:07:40-05:00
> New Revision: 81b42ca95137d0993f7be121c4e307bbb16e2830
>
> URL: https://github.com/llvm/llvm-project/commit/81b42ca95137d0993f7be121c4e307bbb16e2830
> DIFF: https://github.com/llvm/llvm-project/commit/81b42ca95137d0993f7be121c4e307bbb16e2830.diff
>
> LOG: [Hexagon] Handle opaque pointers in vector combine
>
> Added:
>
>
> Modified:
> llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp
>
> Removed:
>
>
>
> ################################################################################
> diff --git a/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp b/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp
> index eea21d7d5baf0..9973822bf3771 100644
> --- a/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp
> +++ b/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp
> @@ -440,12 +440,15 @@ auto AlignVectors::createAdjustedPointer(IRBuilder<> &Builder, Value *Ptr,
> -> Value * {
> // The adjustment is in bytes, but if it's a multiple of the type size,
> // we don't need to do pointer casts.
> - Type *ElemTy = cast<PointerType>(Ptr->getType())->getElementType();
> - int ElemSize = HVC.getSizeOf(ElemTy);
> - if (Adjust % ElemSize == 0) {
> - Value *Tmp0 =
> - Builder.CreateGEP(ElemTy, Ptr, HVC.getConstInt(Adjust / ElemSize));
> - return Builder.CreatePointerCast(Tmp0, ValTy->getPointerTo());
> + auto *PtrTy = cast<PointerType>(Ptr->getType());
> + if (!PtrTy->isOpaque()) {
> + Type *ElemTy = PtrTy->getElementType();
> + int ElemSize = HVC.getSizeOf(ElemTy);
> + if (Adjust % ElemSize == 0) {
> + Value *Tmp0 =
> + Builder.CreateGEP(ElemTy, Ptr, HVC.getConstInt(Adjust / ElemSize));
> + return Builder.CreatePointerCast(Tmp0, ValTy->getPointerTo());
> + }
> }
>
> PointerType *CharPtrTy = Type::getInt8PtrTy(HVC.F.getContext());
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list