[PATCH] D67658: Revert "[SLC] Preserve attrs for strncpy(x, "", y) -> memset(align 1 x, '\0', y)"
Dávid Bolvanský via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 17 08:26:59 PDT 2019
xbolva00 added a comment.
In D67658#1672604 <https://reviews.llvm.org/D67658#1672604>, @lebedev.ri wrote:
> There was several commits touching this code in rapid succession.
> This seems to revert rL372101 <https://reviews.llvm.org/rL372101>, but what about rL372097 <https://reviews.llvm.org/rL372097>, rL372096 <https://reviews.llvm.org/rL372096>, and possibly relevant part of D53342 <https://reviews.llvm.org/D53342>/rL372091 <https://reviews.llvm.org/rL372091> ?
Yeah, but unfortunely. My system GCC 7 does not warn me about that "attrs" bug :/ (testing compiler. fix currently).
The failed test mentions strncat so yeah, maybe this revert is incorrect - but let's just do it to see.
I checked the new code for strncat again and I see nothing bad.
annotateNonNullBasedOnAccess(CI, 0);
if (isKnownNonZero(Size, DL))
annotateNonNullBasedOnAccess(CI, 1);
// We don't do anything if length is not constant.
ConstantInt *LengthArg = dyn_cast<ConstantInt>(Size);
if (LengthArg) {
Len = LengthArg->getZExtValue();
// strncat(x, c, 0) -> x
if (!Len)
return Dst;
} else {
return nullptr;
}
so for "strncat(to - 1, from, 0)" we eliminate strncat call and return "to - 1" ptr. (patch does not change the behaviour here).
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D67658/new/
https://reviews.llvm.org/D67658
More information about the llvm-commits
mailing list