mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-24 12:19:53 +00:00
46fef919d4
Treat loads which clip before the start of a global initializer the same way we treat clipping beyond the end of the initializer: use zeros. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275345 91177308-0d34-0410-b5e6-96231b3b80d8
31 lines
934 B
LLVM
31 lines
934 B
LLVM
; NOTE: Assertions have been autogenerated by update_test_checks.py
|
|
; RUN: opt < %s -instsimplify -S | FileCheck %s
|
|
|
|
@zeroinit = constant {} zeroinitializer
|
|
@undef = constant {} undef
|
|
|
|
define i32 @crash_on_zeroinit() {
|
|
; CHECK-LABEL: @crash_on_zeroinit(
|
|
; CHECK: ret i32 0
|
|
;
|
|
%load = load i32, i32* bitcast ({}* @zeroinit to i32*)
|
|
ret i32 %load
|
|
}
|
|
|
|
define i32 @crash_on_undef() {
|
|
; CHECK-LABEL: @crash_on_undef(
|
|
; CHECK: ret i32 undef
|
|
;
|
|
%load = load i32, i32* bitcast ({}* @undef to i32*)
|
|
ret i32 %load
|
|
}
|
|
|
|
@GV = private constant [8 x i32] [i32 42, i32 43, i32 44, i32 45, i32 46, i32 47, i32 48, i32 49]
|
|
|
|
define <8 x i32> @partial_load() {
|
|
; CHECK-LABEL: @partial_load(
|
|
; CHECK: ret <8 x i32> <i32 0, i32 42, i32 43, i32 44, i32 45, i32 46, i32 47, i32 48>
|
|
%load = load <8 x i32>, <8 x i32>* bitcast (i32* getelementptr ([8 x i32], [8 x i32]* @GV, i64 0, i64 -1) to <8 x i32>*)
|
|
ret <8 x i32> %load
|
|
}
|