[llvm] [WIP] Consider datalayout sentinel pointer value for isKnownNonZero check (PR #91769)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Sat May 11 00:50:13 PDT 2024
================
@@ -0,0 +1,23 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -S -passes=instsimplify < %s | FileCheck %s
+
+target datalayout = "A5-z0:1-z2:neg1-z3:neg1-z5:neg1"
+
+; A 0 valued byval pointer may be valid
+define i1 @byval_may_be_zero(ptr addrspace(5) byval(i32) %ptr) {
+; CHECK-LABEL: @byval_may_be_zero(
+; CHECK-NEXT: ret i1 false
+;
+ %cmp = icmp eq ptr addrspace(5) %ptr, null
+ ret i1 %cmp
+}
+
+; FIXME: The interpretation of nonnull assumes a 0 pointer value, so
+; this really is an incorrect fold.
+define i1 @nonnull_may_be_zero(ptr addrspace(5) nonnull %ptr) {
----------------
arsenm wrote:
Should have copies of identical functions except for the address space
https://github.com/llvm/llvm-project/pull/91769
More information about the llvm-commits
mailing list