brintos

brintos / llvm-project-archived public Read only

0
0
Text · 568 B · 683e723 Raw
19 lines · plain
1; RUN: opt -passes=jump-threading -S %s -o - | FileCheck %s2 3define i32 @f(ptr %a, i64 %i) {4entry:5  store i64 0, ptr %a, align 86  %p = getelementptr i64, ptr %a, i64 %i7  %c = icmp eq ptr %p, null8  ; `%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 well10  ; and must retain the `icmp` instruction.11  ; CHECK: %c = icmp eq ptr %p, null12  br i1 %c, label %if.else, label %if.then13if.then:14  ret i32 015 16if.else:17  ret i32 118}19