[PATCH] D115904: [DSE] Remove calls with known writes to dead memory

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 18 00:32:18 PST 2021


nikic reopened this revision.
nikic added a comment.
This revision is now accepted and ready to land.

Reverted this because it does break the strncpy-overflow.cpp test case in asan (https://github.com/llvm/llvm-project/blob/main/compiler-rt/test/asan/TestCases/strncpy-overflow.cpp). The strncpy is now getting optimized away (correctly). Not sure what the policy in this case is, but I assume it's updating the test case to be more robust rather than trying to avoid the optimization in sanitized functions?

I found this change a bit surprising because I thought we'd already do this based on the previous attribute code in InstCombine. The reason we didn't is that strncpy returns the first argument, which means that it's not nocapture. But we do provide getForDest() information for this libcall, and that got exposed to InstCombine now.

I guess this is also why you say failures when dropping the libcall handling: We do still need it for libcalls that return the argument.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115904



More information about the llvm-commits mailing list