mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 05:01:59 +01:00
16a7995997
Summary: Getelementptr returns a vector of pointers, instead of a single address, when one or more of its arguments is a vector. In such case it is not possible to simplify the expression by inserting a bitcast of operand(0) into the destination type, as it will create a bitcast between different sizes. Reviewers: majnemer, mkuper, mssimpso, spatel Reviewed By: spatel Subscribers: lebedev.ri, llvm-commits Differential Revision: https://reviews.llvm.org/D46379 llvm-svn: 333783
30 lines
1.2 KiB
LLVM
30 lines
1.2 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
|
; RUN: opt < %s -constprop -S -o - | FileCheck %s
|
|
|
|
; Testcase that verify that we don't get a faulty bitcast that cast between
|
|
; different sizes.
|
|
|
|
%rec8 = type { i16 }
|
|
@a = global [1 x %rec8] zeroinitializer
|
|
|
|
define <2 x i16*> @test_gep() {
|
|
; CHECK-LABEL: @test_gep(
|
|
; CHECK-NEXT: ret <2 x i16*> <i16* getelementptr inbounds (%rec8, %rec8* extractelement (<2 x %rec8*> getelementptr ([1 x %rec8], [1 x %rec8]* @a, <2 x i64> zeroinitializer, <2 x i64> zeroinitializer), i32 0), i32 0, i32 0), i16* getelementptr inbounds (%rec8, %rec8* extractelement (<2 x %rec8*> getelementptr ([1 x %rec8], [1 x %rec8]* @a, <2 x i64> zeroinitializer, <2 x i64> zeroinitializer), i32 1), i32 0, i32 0)>
|
|
;
|
|
%A = getelementptr [1 x %rec8], [1 x %rec8]* @a, <2 x i16> zeroinitializer, <2 x i64> zeroinitializer
|
|
%B = bitcast <2 x %rec8*> %A to <2 x i16*>
|
|
ret <2 x i16*> %B
|
|
}
|
|
|
|
; Testcase that verify the cast-of-cast when the outer/second cast is to a
|
|
; vector type.
|
|
|
|
define <4 x i16> @test_mmx_const() {
|
|
; CHECK-LABEL: @test_mmx_const(
|
|
; CHECK-NEXT: ret <4 x i16> zeroinitializer
|
|
;
|
|
%A = bitcast <2 x i32> zeroinitializer to x86_mmx
|
|
%B = bitcast x86_mmx %A to <4 x i16>
|
|
ret <4 x i16> %B
|
|
}
|