[PATCH] D50233: [InstCombine] Transform str(n)cmp to memcmp
Adam Reichold via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 4 12:41:53 PDT 2018
adamreichold added a comment.
In https://reviews.llvm.org/D50233#1223683, @efriedma wrote:
> > Does LLVM's implementation somehow guarantee that no later optimization pass comes along, sees the program reading uninitialized memory and declares UB?
>
> In LLVM IR, reading uninitialized memory isn't itself UB; it's only UB if you perform certain operations on the result. Granted, a naive LLVM IR implementation of memcmp might involve operations which lead to UB.
But that also implies that you have to emit an inline implementation since you might not control what the implementation of `memcmp` supplied by `libc` does?
Repository:
rL LLVM
https://reviews.llvm.org/D50233
More information about the llvm-commits
mailing list