1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt -S -instsimplify < %s | FileCheck %s
3
4target datalayout = "A5"
5
6; A 0 valued byval pointer may be valid
7define i1 @byval_may_be_zero(i32 addrspace(5)* byval(i32) %ptr) {
8; CHECK-LABEL: @byval_may_be_zero(
9; CHECK-NEXT:    [[CMP:%.*]] = icmp eq i32 addrspace(5)* [[PTR:%.*]], null
10; CHECK-NEXT:    ret i1 [[CMP]]
11;
12  %cmp = icmp eq i32 addrspace(5)* %ptr, null
13  ret i1 %cmp
14}
15
16; FIXME: The interpretation of nonnull assumes a 0 pointer value, so
17; this really is an incorrect fold.
18define i1 @nonnull_may_be_zero(i32 addrspace(5)* nonnull %ptr) {
19; CHECK-LABEL: @nonnull_may_be_zero(
20; CHECK-NEXT:    ret i1 false
21;
22  %cmp = icmp eq i32 addrspace(5)* %ptr, null
23  ret i1 %cmp
24}
25