Skip to content

Commit

Permalink
[InstSimplify] Add test for load from undef (NFC)
Browse files Browse the repository at this point in the history
If we're loading from an all-undef value, we sometimes still
return zero rather than undef.
  • Loading branch information
nikic committed Jan 14, 2022
1 parent be21932 commit e7ce6ac
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions llvm/test/Transforms/InstSimplify/ConstProp/loads.ll
Expand Up @@ -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
}

0 comments on commit e7ce6ac

Please sign in to comment.