This patch extends the OptimizeGlobalAddressOfMalloc to handle the null check of...
authorShimin Cui <scui@ca.ibm.com>
Tue, 20 Jul 2021 16:27:26 +0000 (12:27 -0400)
committerShimin Cui <scui@ca.ibm.com>
Tue, 20 Jul 2021 16:27:26 +0000 (12:27 -0400)
commit0b043bb39bf0e24827a1a4042a661cfb9899e0b0
treed8f0279dc1e801b213094000a6bed422610d2716
parent81efb825703c16ae659f3e17834ab011d06926e3
 This patch extends the OptimizeGlobalAddressOfMalloc to handle the null check of global pointer variables. It is disabled with https://reviews.llvm.org/rGb7cd291c1542aee12c9e9fde6c411314a163a8ea. This PR is to reenable it while fixing the original problem reported. The fix is to set the store value correctly when creating store for the new created global init bool symbol.

Reviewed By: efriedma

Differential Revision:  https://reviews.llvm.org/D102711
llvm/lib/Transforms/IPO/GlobalOpt.cpp
llvm/test/Transforms/GlobalOpt/malloc-promote-4.ll [new file with mode: 0644]
llvm/test/Transforms/GlobalOpt/null-check-is-use-pr35760.ll
llvm/test/Transforms/GlobalOpt/null-check-not-use-pr35760.ll [new file with mode: 0644]