[PATCH] D26060: [ConstantFolding] Don't try to cast vectors to pointer if they have different size
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 28 15:38:12 PDT 2016
davide added a comment.
In https://reviews.llvm.org/D26060#582443, @filcab wrote:
> Using undef in tests can hide some things.
> Can you tell me what you get with your test case for this?
>
> %struct.foo = type { [1 x i64] }
>
> define <4 x i64*> @patatino3(%struct.foo*) {
> %2 = getelementptr inbounds %struct.foo, %struct.foo* %0, i32 0,
> i32 0, <4 x i8> zeroinitializer
> ret <4 x i64*> %2
> }
>
>
> clang 3.9 gives me this:
>
> define <4 x i64*> @patatino3(%struct.foo* readnone) local_unnamed_addr #0 {
> %2 = getelementptr inbounds %struct.foo, %struct.foo* %0, i64 0, i32 0, <4 x i64> zeroinitializer
> ret <4 x i64*> %2
> }
>
>
> Where the first i32 and the i8 vector have been cast to i64 and i64 vector.
This is what I get
[davide at localhost bin]$ ./opt -instcombine filcab.ll -o - -S
; ModuleID = 'filcab.ll'
source_filename = "filcab.ll"
%struct.foo = type { [1 x i64] }
define <4 x i64*> @patatino3(%struct.foo*) {
%2 = getelementptr inbounds %struct.foo, %struct.foo* %0, i64 0, i32 0, <4 x i64> zeroinitializer
ret <4 x i64*> %2
}
[davide at localhost bin]$ cat filcab.ll
%struct.foo = type { [1 x i64] }
define <4 x i64*> @patatino3(%struct.foo*) {
%2 = getelementptr inbounds %struct.foo, %struct.foo* %0, i32 0,
i32 0, <4 x i8> zeroinitializer
ret <4 x i64*> %2
}
which I think is what is expected, but another pair of eyes wouldn't hurt
https://reviews.llvm.org/D26060
More information about the llvm-commits
mailing list