[instcombine] Exploit UB implied by nofree attributes
authorPhilip Reames <listmail@philipreames.com>
Thu, 18 Feb 2021 16:33:12 +0000 (08:33 -0800)
committerPhilip Reames <listmail@philipreames.com>
Thu, 18 Feb 2021 16:34:22 +0000 (08:34 -0800)
commit86664638898e9c3756ad17d612de1873fead6813
treefa706538b78676faf11c5eb6cf74f409d48cd677
parent46757ccb49ab88da54ca8ddd43665d5255ee80f7
[instcombine] Exploit UB implied by nofree attributes

This patch simply implements the documented UB of the current nofree attributes as specified. It doesn't try to be fancy about inference (yet), it just implements the cases already specified and inferred.

Note: When this lands, it may expose miscompiles. If so, please revert and provide a test case. It's likely the bug is in the existing inference code and without a relatively complete test case, it will be hard to debug.

Differential Revision: https://reviews.llvm.org/D96349
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
llvm/test/Transforms/InstCombine/malloc-free-delete.ll