1; RUN: opt -passes=jump-threading -S %s -o - | FileCheck %s 2 3define i32 @f(ptr %a, i64 %i) { 4entry: 5 store i64 0, ptr %a, align 8 6 %p = getelementptr i64, ptr %a, i64 %i 7 %c = icmp eq ptr %p, null 8 ; `%a` is non-null at the end of the block, because we store through it. 9 ; However, `%p` is derived from `%a` via a GEP that is not `inbounds`, therefore we cannot judge `%p` is non-null as well 10 ; and must retain the `icmp` instruction. 11 ; CHECK: %c = icmp eq ptr %p, null 12 br i1 %c, label %if.else, label %if.then 13if.then: 14 ret i32 0 15 16if.else: 17 ret i32 1 18} 19