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