forked from OSchip/llvm-project
[GlobalOpt] Add test for SRA with i8 array type (NFC)
This commit is contained in:
parent
8dbc6a23bb
commit
be219323a2
|
@ -0,0 +1,33 @@
|
|||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt -S -globalopt < %s | FileCheck %s
|
||||
|
||||
@g = internal global [8 x i8] undef
|
||||
|
||||
define void @test() {
|
||||
; CHECK-LABEL: @test(
|
||||
; CHECK-NEXT: store i32 1, i32* bitcast ([8 x i8]* @g to i32*), align 4
|
||||
; CHECK-NEXT: store i32 2, i32* getelementptr (i32, i32* bitcast ([8 x i8]* @g to i32*), i64 1), align 4
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
store i32 1, i32* bitcast ([8 x i8]* @g to i32*)
|
||||
store i32 2, i32* getelementptr (i32, i32* bitcast ([8 x i8]* @g to i32*), i64 1)
|
||||
ret void
|
||||
}
|
||||
|
||||
define i32 @load1() {
|
||||
; CHECK-LABEL: @load1(
|
||||
; CHECK-NEXT: [[V:%.*]] = load i32, i32* bitcast ([8 x i8]* @g to i32*), align 4
|
||||
; CHECK-NEXT: ret i32 [[V]]
|
||||
;
|
||||
%v = load i32, i32* bitcast ([8 x i8]* @g to i32*)
|
||||
ret i32 %v
|
||||
}
|
||||
|
||||
define i32 @load2() {
|
||||
; CHECK-LABEL: @load2(
|
||||
; CHECK-NEXT: [[V:%.*]] = load i32, i32* getelementptr (i32, i32* bitcast ([8 x i8]* @g to i32*), i64 1), align 4
|
||||
; CHECK-NEXT: ret i32 [[V]]
|
||||
;
|
||||
%v = load i32, i32* getelementptr (i32, i32* bitcast ([8 x i8]* @g to i32*), i64 1)
|
||||
ret i32 %v
|
||||
}
|
Loading…
Reference in New Issue