store i8 1, i8* %gep.2
ret void
}
+
+; FIXME: While %n is non-zero, its low 32 bits may not be.
+define void @mayalias_overflow_in_32_bit_non_zero(i8* %ptr, i64 %n) {
+; CHECK-LABEL: Function: mayalias_overflow_in_32_bit_non_zero
+; CHECK: NoAlias: i8* %gep, i8* %ptr
+;
+ %c = icmp ne i64 %n, 0
+ call void @llvm.assume(i1 %c)
+ store i8 0, i8* %ptr
+ %gep = getelementptr i8, i8* %ptr, i64 %n
+ store i8 1, i8* %gep
+ ret void
+}
+
+; FIXME: While %n is positive, its low 32 bits may not be.
+define void @mayalias_overflow_in_32_bit_positive(i8* %ptr, i64 %n) {
+; CHECK-LABEL: Function: mayalias_overflow_in_32_bit_positive
+; CHECK: NoAlias: i8* %gep.1, i8* %ptr
+; CHECK: NoAlias: i8* %gep.2, i8* %ptr
+; CHECK: NoAlias: i8* %gep.1, i8* %gep.2
+;
+ %c = icmp sgt i64 %n, 0
+ call void @llvm.assume(i1 %c)
+ %gep.1 = getelementptr i8, i8* %ptr, i64 -1
+ store i8 0, i8* %gep.1
+ %gep.2 = getelementptr i8, i8* %ptr, i64 %n
+ store i8 1, i8* %gep.2
+ ret void
+}