[InstSimplify] Add test for load from undef (NFC)

If we're loading from an all-undef value, we sometimes still
return zero rather than undef.
This commit is contained in:
Nikita Popov 2022-01-14 09:57:03 +01:00
parent be219323a2
commit e7ce6acc83
1 changed files with 11 additions and 0 deletions

View File

@ -325,3 +325,14 @@ define i32 @load_padding() {
%v = load i32, i32* getelementptr (i32, i32* bitcast ({ i32, [4 x i8] }* @g_with_padding to i32*), i64 1)
ret i32 %v
}
@g_all_undef = constant { i32, [4 x i8] } undef
; Same as the previous case, but with an all-undef initializer.
define i32 @load_all_undef() {
; CHECK-LABEL: @load_all_undef(
; CHECK-NEXT: ret i32 0
;
%v = load i32, i32* getelementptr (i32, i32* bitcast ({ i32, [4 x i8] }* @g_all_undef to i32*), i64 1)
ret i32 %v
}