mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-16 11:30:51 +00:00
6de0a12927
We didn't properly handle the out-of-bounds case for ConstantAggregateZero and UndefValue. This would manifest as a crash when the constant folder was asked to fold a load of a constant global whose struct type has no operands. This fixes PR22595. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229352 91177308-0d34-0410-b5e6-96231b3b80d8
20 lines
428 B
LLVM
20 lines
428 B
LLVM
; 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* bitcast ({}* @zeroinit to i32*)
|
|
ret i32 %load
|
|
}
|
|
|
|
define i32 @crash_on_undef() {
|
|
; CHECK-LABEL: @crash_on_undef
|
|
; CHECK: ret i32 undef
|
|
%load = load i32* bitcast ({}* @undef to i32*)
|
|
ret i32 %load
|
|
}
|
|
|