[PATCH] D55147: Exclude non-integral pointers in isBytewiseValue

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 3 12:22:45 PST 2018


efriedma added inline comments.


================
Comment at: test/Transforms/MemCpyOpt/non-integral-ptr.ll:19
+  %2 = bitcast i8 addrspace(1)** @const0 to i8*
+  call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %1, i8* align 8 %2, i64 8, i1 false)
+  ret void
----------------
It's not clear to me why a memset is "wrong" here; either way, you're setting all the bits to zero.  Is the issue that const0 is not actually an all-zero constant?

The LLVM null pointer constant is treated as an all-zero value in LLVM, even on targets where a null pointer constant in C would have some non-zero value.  If you think that isn't appropriate, please start a thread on llvmdev; I haven't really thought it through completely, but it would probably get complicated due to the impact on various transforms like constant folding.  If you need an "opaque" null pointer constant, there's probably a simpler solution: define a special global @llvm.opaque.nullptr or something like that, and make your frontend use it instead of ConstantPointerNull.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55147/new/

https://reviews.llvm.org/D55147





More information about the llvm-commits mailing list