blob: 324d03a79f3231efaf5b1308b8ade1b4e88d2fa7 [file]
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
; RUN: opt -passes=constraint-elimination -S %s | FileCheck %s
target datalayout = "e-m:e-p:16:16"
%s = type { [65536 x i8], i8 }
; Offset of the struct's second field does not fit into a 16 bit pointer.
define i1 @cmp_gep_struct_offset_exceeds_index_width(ptr %p) {
; CHECK-LABEL: define i1 @cmp_gep_struct_offset_exceeds_index_width(
; CHECK-SAME: ptr [[P:%.*]]) {
; CHECK-NEXT: [[A:%.*]] = getelementptr inbounds [[S:%.*]], ptr [[P]], i16 0, i32 1
; CHECK-NEXT: ret i1 false
;
%a = getelementptr inbounds %s, ptr %p, i16 0, i32 1
%c = icmp ult ptr %a, %p
ret i1 %c
}
define i1 @cmp_geps_struct_offset_exceeds_index_width(ptr %p) {
; CHECK-LABEL: define i1 @cmp_geps_struct_offset_exceeds_index_width(
; CHECK-SAME: ptr [[P:%.*]]) {
; CHECK-NEXT: [[A:%.*]] = getelementptr inbounds [[S:%.*]], ptr [[P]], i16 0, i32 1
; CHECK-NEXT: [[B:%.*]] = getelementptr inbounds i8, ptr [[P]], i16 1
; CHECK-NEXT: ret i1 true
;
%a = getelementptr inbounds %s, ptr %p, i16 0, i32 1
%b = getelementptr inbounds i8, ptr %p, i16 1
%c = icmp ult ptr %a, %b
ret i1 %c
}