Skip to content

Commit 0e3837b

Browse files
committed
[InstSimplify] Add more tests. NFC.
1 parent e437ba2 commit 0e3837b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

llvm/test/Transforms/InstSimplify/select-icmp.ll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,3 +264,15 @@ define ptr @icmp_ptr_eq_replace_null(ptr %a) {
264264
%sel = select i1 %cmp, ptr null, ptr %a
265265
ret ptr %sel
266266
}
267+
268+
define ptr @ptr_eq_replace_same_underlying_object(ptr %st, i64 %i, i64 %j) {
269+
; CHECK-LABEL: @ptr_eq_replace_same_underlying_object(
270+
; CHECK-NEXT: [[B:%.*]] = getelementptr inbounds i8, ptr [[ST:%.*]], i64 [[J:%.*]]
271+
; CHECK-NEXT: ret ptr [[B]]
272+
;
273+
%a = getelementptr inbounds i8, ptr %st, i64 %i
274+
%b = getelementptr inbounds i8, ptr %st, i64 %j
275+
%cmp = icmp eq ptr %a, %b
276+
%sel = select i1 %cmp, ptr %a, ptr %b
277+
ret ptr %sel
278+
}

0 commit comments

Comments
 (0)