forked from OSchip/llvm-project
[PatternMatch] Make m_VScale compatible with opaque pointers
Use GEP source type instead of pointer element type.
This commit is contained in:
parent
e6a353061f
commit
70b1a8c095
|
@ -2437,8 +2437,8 @@ public:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (m_PtrToInt(m_OffsetGep(m_Zero(), m_SpecificInt(1))).match(V)) {
|
if (m_PtrToInt(m_OffsetGep(m_Zero(), m_SpecificInt(1))).match(V)) {
|
||||||
Type *PtrTy = cast<Operator>(V)->getOperand(0)->getType();
|
auto *GEP = cast<GEPOperator>(cast<Operator>(V)->getOperand(0));
|
||||||
auto *DerefTy = PtrTy->getPointerElementType();
|
auto *DerefTy = GEP->getSourceElementType();
|
||||||
if (isa<ScalableVectorType>(DerefTy) &&
|
if (isa<ScalableVectorType>(DerefTy) &&
|
||||||
DL.getTypeAllocSizeInBits(DerefTy).getKnownMinSize() == 8)
|
DL.getTypeAllocSizeInBits(DerefTy).getKnownMinSize() == 8)
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -48,6 +48,13 @@ define i32 @rdvl_const() nounwind {
|
||||||
ret i32 mul nsw (i32 ptrtoint (<vscale x 1 x i8>* getelementptr (<vscale x 1 x i8>, <vscale x 1 x i8>* null, i64 1) to i32), i32 16)
|
ret i32 mul nsw (i32 ptrtoint (<vscale x 1 x i8>* getelementptr (<vscale x 1 x i8>, <vscale x 1 x i8>* null, i64 1) to i32), i32 16)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
; CHECK-LABEL: rdvl_const_opaque_ptr:
|
||||||
|
; CHECK: rdvl x0, #1
|
||||||
|
; CHECK-NEXT: ret
|
||||||
|
define i32 @rdvl_const_opaque_ptr() nounwind {
|
||||||
|
ret i32 mul nsw (i32 ptrtoint (ptr getelementptr (<vscale x 1 x i8>, ptr null, i64 1) to i32), i32 16)
|
||||||
|
}
|
||||||
|
|
||||||
define i32 @vscale_1() nounwind {
|
define i32 @vscale_1() nounwind {
|
||||||
; CHECK-LABEL: vscale_1:
|
; CHECK-LABEL: vscale_1:
|
||||||
; CHECK: rdvl [[TMP:x[0-9]+]], #1
|
; CHECK: rdvl [[TMP:x[0-9]+]], #1
|
||||||
|
|
Loading…
Reference in New Issue