mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
Allow SROA to look at a vector type and see if the offset is out of range to be replaced with a scalar access
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158407 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1a18e9a2c4
commit
51786e0aae
@ -1764,6 +1764,12 @@ bool SROA::TypeHasComponent(Type *T, uint64_t Offset, uint64_t Size) {
|
||||
if (Offset >= AT->getNumElements() * EltSize)
|
||||
return false;
|
||||
Offset %= EltSize;
|
||||
} else if (VectorType *VT = dyn_cast<VectorType>(T)) {
|
||||
EltTy = VT->getElementType();
|
||||
EltSize = TD->getTypeAllocSize(EltTy);
|
||||
if (Offset >= VT->getNumElements() * EltSize)
|
||||
return false;
|
||||
Offset %= EltSize;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -10,8 +10,7 @@ target triple = "x86_64-apple-macosx10.7.0"
|
||||
|
||||
; CHECK: main
|
||||
; CHECK-NOT: alloca
|
||||
; CHECK: %[[A:[a-z0-9]*]] = and i128
|
||||
; CHECK: %[[B:[a-z0-9]*]] = trunc i128 %[[A]] to i32
|
||||
; CHECK: extractelement <2 x float> zeroinitializer, i32 0
|
||||
|
||||
define void @main() uwtable ssp {
|
||||
entry:
|
||||
@ -28,8 +27,7 @@ entry:
|
||||
|
||||
; CHECK: test1
|
||||
; CHECK-NOT: alloca
|
||||
; CHECK: %[[A:[a-z0-9]*]] = and i128
|
||||
; CHECK: %[[B:[a-z0-9]*]] = trunc i128 %[[A]] to i32
|
||||
; CHECK: extractelement <2 x float> zeroinitializer, i32 0
|
||||
|
||||
define void @test1() uwtable ssp {
|
||||
entry:
|
||||
@ -43,9 +41,8 @@ entry:
|
||||
|
||||
; CHECK: test2
|
||||
; CHECK-NOT: alloca
|
||||
; CHECK: and i128
|
||||
; CHECK: or i128
|
||||
; CHECK: trunc i128
|
||||
; CHECK: %[[A:[a-z0-9]*]] = extractelement <2 x float> zeroinitializer, i32 0
|
||||
; CHECK: fadd float %[[A]], 1.000000e+00
|
||||
; CHECK-NOT: insertelement
|
||||
; CHECK-NOT: extractelement
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user