Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
llvm-doe
llvm-project
Commits
8911a351
Unverified
Commit
8911a351
authored
Jun 25, 2020
by
Roman Lebedev
Browse files
[SROA] convertValue(): we can have <N x iK*> to <M x iQ> cast
Provided test case crashes otherwise. Much like to the opposite case.
parent
07a23c06
Changes
2
Hide whitespace changes
Inline
Side-by-side
llvm/lib/Transforms/Scalar/SROA.cpp
View file @
8911a351
...
...
@@ -1757,20 +1757,14 @@ static Value *convertValue(const DataLayout &DL, IRBuilderTy &IRB, Value *V,
NewTy
);
}
// See if we need ptrtoint for this type pair. A cast involving both scalars
// and vectors requires and additional bitcast.
// See if we need ptrtoint for this type pair. May require additional bitcast.
if
(
OldTy
->
isPtrOrPtrVectorTy
()
&&
NewTy
->
isIntOrIntVectorTy
())
{
// Expand <2 x i8*> to i128 --> <2 x i8*> to <2 x i64> to i128
if
(
OldTy
->
isVectorTy
()
&&
!
NewTy
->
isVectorTy
())
return
IRB
.
CreateBitCast
(
IRB
.
CreatePtrToInt
(
V
,
DL
.
getIntPtrType
(
OldTy
)),
NewTy
);
// Expand i8* to <2 x i32> --> i8* to i64 to <2 x i32>
if
(
!
OldTy
->
isVectorTy
()
&&
NewTy
->
isVectorTy
())
return
IRB
.
CreateBitCast
(
IRB
.
CreatePtrToInt
(
V
,
DL
.
getIntPtrType
(
OldTy
)),
NewTy
);
return
IRB
.
CreatePtrToInt
(
V
,
NewTy
);
// Expand <2 x i8*> to <4 x i32> --> <2 x i8*> to <2 x i64> to <4 x i32>
// Expand i8* to i64 --> i8* to i64 to i64
return
IRB
.
CreateBitCast
(
IRB
.
CreatePtrToInt
(
V
,
DL
.
getIntPtrType
(
OldTy
)),
NewTy
);
}
if
(
OldTy
->
isPtrOrPtrVectorTy
()
&&
NewTy
->
isPtrOrPtrVectorTy
())
{
...
...
llvm/test/Transforms/SROA/vector-conversion.ll
View file @
8911a351
...
...
@@ -70,3 +70,22 @@ define <2 x i8*> @vector_inttoptrbitcast_vector({<16 x i8>, <16 x i8>} %x) {
ret
<
2
x
i8
*>
%vec
}
define
<
16
x
i8
>
@vector_ptrtointbitcast_vector
({<
2
x
i8
*>,
<
2
x
i8
*>}
%x
)
{
; CHECK-LABEL: @vector_ptrtointbitcast_vector(
%a
=
alloca
{<
2
x
i8
*>,
<
2
x
i8
*>}
; CHECK-NOT: alloca
store
{<
2
x
i8
*>,
<
2
x
i8
*>}
%x
,
{<
2
x
i8
*>,
<
2
x
i8
*>}*
%a
; CHECK-NOT: store
%cast
=
bitcast
{<
2
x
i8
*>,
<
2
x
i8
*>}*
%a
to
<
16
x
i8
>*
%vec
=
load
<
16
x
i8
>,
<
16
x
i8
>*
%cast
; CHECK-NOT: load
; CHECK: extractvalue
; CHECK: ptrtoint
; CHECK: bitcast
; CHECK: extractvalue
ret
<
16
x
i8
>
%vec
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment