Skip to content

Commit 876174f

Browse files
committed
[InstCombine] Test for ephemeral nonnull load. (NFC)
1 parent 126016b commit 876174f

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

llvm/test/Transforms/InstCombine/assume.ll

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,23 @@ not_taken:
581581
ret i1 %control
582582
}
583583

584+
define void @nonnull_only_ephemeral_use(ptr %p) {
585+
; DEFAULT-LABEL: @nonnull_only_ephemeral_use(
586+
; DEFAULT-NEXT: [[A:%.*]] = load ptr, ptr [[P:%.*]], align 8
587+
; DEFAULT-NEXT: [[CMP:%.*]] = icmp ne ptr [[A]], null
588+
; DEFAULT-NEXT: tail call void @llvm.assume(i1 [[CMP]])
589+
; DEFAULT-NEXT: ret void
590+
;
591+
; BUNDLES-LABEL: @nonnull_only_ephemeral_use(
592+
; BUNDLES-NEXT: [[A:%.*]] = load ptr, ptr [[P:%.*]], align 8
593+
; BUNDLES-NEXT: call void @llvm.assume(i1 true) [ "nonnull"(ptr [[A]]) ]
594+
; BUNDLES-NEXT: ret void
595+
;
596+
%a = load ptr, ptr %p
597+
%cmp = icmp ne ptr %a, null
598+
tail call void @llvm.assume(i1 %cmp)
599+
ret void
600+
}
584601

585602
define void @always_true_assumption() {
586603
; CHECK-LABEL: @always_true_assumption(

0 commit comments

Comments
 (0)