[llvm] 81b42ca - [Hexagon] Handle opaque pointers in vector combine
Krzysztof Parzyszek via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 2 11:08:04 PDT 2021
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());
More information about the llvm-commits
mailing list