mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 05:01:59 +01:00
[InstCombine] auto-generate checks; NFC
llvm-svn: 338388
This commit is contained in:
parent
c42a835009
commit
15e5eea781
@ -1,3 +1,4 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt < %s -instcombine -S | FileCheck %s
|
||||
|
||||
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
|
||||
@ -7,7 +8,9 @@ target triple = "x86_64-pc-win32"
|
||||
|
||||
; make sure that we are not crashing when creating an illegal type
|
||||
define void @func(%myStruct addrspace(1)* nocapture %p) nounwind {
|
||||
ST:
|
||||
; CHECK-LABEL: @func(
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
%A = getelementptr inbounds %myStruct, %myStruct addrspace(1)* %p, i64 0
|
||||
%B = addrspacecast %myStruct addrspace(1)* %A to %myStruct*
|
||||
%C = getelementptr inbounds %myStruct, %myStruct* %B, i32 0, i32 1
|
||||
@ -21,14 +24,19 @@ ST:
|
||||
@scalar = internal addrspace(3) global float 0.000000e+00, align 4
|
||||
|
||||
define void @keep_necessary_addrspacecast(i64 %i, float** %out0, float** %out1) {
|
||||
entry:
|
||||
; CHECK-LABEL: @keep_necessary_addrspacecast
|
||||
%0 = getelementptr [256 x float], [256 x float]* addrspacecast ([256 x float] addrspace(3)* @array to [256 x float]*), i64 0, i64 %i
|
||||
; CHECK: addrspacecast float addrspace(3)* %{{[0-9]+}} to float*
|
||||
%1 = getelementptr [0 x float], [0 x float]* addrspacecast (float addrspace(3)* @scalar to [0 x float]*), i64 0, i64 %i
|
||||
; CHECK: addrspacecast float addrspace(3)* %{{[0-9]+}} to float*
|
||||
store float* %0, float** %out0, align 4
|
||||
store float* %1, float** %out1, align 4
|
||||
; CHECK-LABEL: @keep_necessary_addrspacecast(
|
||||
; CHECK-NEXT: [[T01:%.*]] = getelementptr [256 x float], [256 x float] addrspace(3)* @array, i64 0, i64 [[I:%.*]]
|
||||
; CHECK-NEXT: [[T0:%.*]] = addrspacecast float addrspace(3)* [[T01]] to float*
|
||||
; CHECK-NEXT: [[TMP1:%.*]] = getelementptr float, float addrspace(3)* @scalar, i64 [[I]]
|
||||
; CHECK-NEXT: [[T1:%.*]] = addrspacecast float addrspace(3)* [[TMP1]] to float*
|
||||
; CHECK-NEXT: store float* [[T0]], float** [[OUT0:%.*]], align 4
|
||||
; CHECK-NEXT: store float* [[T1]], float** [[OUT1:%.*]], align 4
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
%t0 = getelementptr [256 x float], [256 x float]* addrspacecast ([256 x float] addrspace(3)* @array to [256 x float]*), i64 0, i64 %i
|
||||
%t1 = getelementptr [0 x float], [0 x float]* addrspacecast (float addrspace(3)* @scalar to [0 x float]*), i64 0, i64 %i
|
||||
store float* %t0, float** %out0, align 4
|
||||
store float* %t1, float** %out1, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
@ -37,17 +45,23 @@ declare void @escape_alloca(i16*)
|
||||
; check that addrspacecast is not ignored (leading to an assertion failure)
|
||||
; when trying to mark a GEP as inbounds
|
||||
define { i8, i8 } @inbounds_after_addrspacecast() {
|
||||
top:
|
||||
; CHECK-LABEL: @inbounds_after_addrspacecast
|
||||
%0 = alloca i16, align 2
|
||||
call void @escape_alloca(i16* %0)
|
||||
%tmpcast = bitcast i16* %0 to [2 x i8]*
|
||||
; CHECK: addrspacecast [2 x i8]* %tmpcast to [2 x i8] addrspace(11)*
|
||||
%1 = addrspacecast [2 x i8]* %tmpcast to [2 x i8] addrspace(11)*
|
||||
; CHECK: getelementptr [2 x i8], [2 x i8] addrspace(11)* %1, i64 0, i64 1
|
||||
%2 = getelementptr [2 x i8], [2 x i8] addrspace(11)* %1, i64 0, i64 1
|
||||
; CHECK: addrspace(11)
|
||||
%3 = load i8, i8 addrspace(11)* %2, align 1
|
||||
%.fca.1.insert = insertvalue { i8, i8 } zeroinitializer, i8 %3, 1
|
||||
ret { i8, i8 } %.fca.1.insert
|
||||
; CHECK-LABEL: @inbounds_after_addrspacecast(
|
||||
; CHECK-NEXT: [[T0:%.*]] = alloca i16, align 2
|
||||
; CHECK-NEXT: call void @escape_alloca(i16* nonnull [[T0]])
|
||||
; CHECK-NEXT: [[TMPCAST:%.*]] = bitcast i16* [[T0]] to [2 x i8]*
|
||||
; CHECK-NEXT: [[T1:%.*]] = addrspacecast [2 x i8]* [[TMPCAST]] to [2 x i8] addrspace(11)*
|
||||
; CHECK-NEXT: [[T2:%.*]] = getelementptr [2 x i8], [2 x i8] addrspace(11)* [[T1]], i64 0, i64 1
|
||||
; CHECK-NEXT: [[T3:%.*]] = load i8, i8 addrspace(11)* [[T2]], align 1
|
||||
; CHECK-NEXT: [[INSERT:%.*]] = insertvalue { i8, i8 } zeroinitializer, i8 [[T3]], 1
|
||||
; CHECK-NEXT: ret { i8, i8 } [[INSERT]]
|
||||
;
|
||||
%t0 = alloca i16, align 2
|
||||
call void @escape_alloca(i16* %t0)
|
||||
%tmpcast = bitcast i16* %t0 to [2 x i8]*
|
||||
%t1 = addrspacecast [2 x i8]* %tmpcast to [2 x i8] addrspace(11)*
|
||||
%t2 = getelementptr [2 x i8], [2 x i8] addrspace(11)* %t1, i64 0, i64 1
|
||||
%t3 = load i8, i8 addrspace(11)* %t2, align 1
|
||||
%insert = insertvalue { i8, i8 } zeroinitializer, i8 %t3, 1
|
||||
ret { i8, i8 } %insert
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user