[PATCH] D52635: [FunctionAttrs] Propagate nonnull argument attributes from callsites to callers
Dávid Bolvanský via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 27 15:13:26 PDT 2018
xbolva00 created this revision.
xbolva00 added reviewers: efriedma, spatel.
Herald added a subscriber: llvm-commits.
Some time ago, this propagation was disabled due to some security concers:
http://lists.llvm.org/pipermail/cfe-dev/2017-January/052066.html
Later, this issue was fixed on Clang side in https://reviews.llvm.org/rC298491. This patch (re)enables it by default in LLVM.
Repository:
rL LLVM
https://reviews.llvm.org/D52635
Files:
lib/Transforms/IPO/FunctionAttrs.cpp
test/Transforms/FunctionAttrs/nonnull.ll
Index: test/Transforms/FunctionAttrs/nonnull.ll
===================================================================
--- test/Transforms/FunctionAttrs/nonnull.ll
+++ test/Transforms/FunctionAttrs/nonnull.ll
@@ -1,5 +1,5 @@
-; RUN: opt -S -functionattrs -enable-nonnull-arg-prop %s | FileCheck %s
-; RUN: opt -S -passes=function-attrs -enable-nonnull-arg-prop %s | FileCheck %s
+; RUN: opt -S -functionattrs %s | FileCheck %s
+; RUN: opt -S -passes=function-attrs %s | FileCheck %s
declare nonnull i8* @ret_nonnull()
Index: lib/Transforms/IPO/FunctionAttrs.cpp
===================================================================
--- lib/Transforms/IPO/FunctionAttrs.cpp
+++ lib/Transforms/IPO/FunctionAttrs.cpp
@@ -76,14 +76,6 @@
STATISTIC(NumNoRecurse, "Number of functions marked as norecurse");
STATISTIC(NumNoUnwind, "Number of functions marked as nounwind");
-// FIXME: This is disabled by default to avoid exposing security vulnerabilities
-// in C/C++ code compiled by clang:
-// http://lists.llvm.org/pipermail/cfe-dev/2017-January/052066.html
-static cl::opt<bool> EnableNonnullArgPropagation(
- "enable-nonnull-arg-prop", cl::Hidden,
- cl::desc("Try to propagate nonnull argument attributes from callsites to "
- "caller functions."));
-
static cl::opt<bool> DisableNoUnwindInference(
"disable-nounwind-inference", cl::Hidden,
cl::desc("Stop inferring nounwind attribute during function-attrs pass"));
@@ -618,9 +610,6 @@
/// arguments. This may be important because inlining can cause information loss
/// when attribute knowledge disappears with the inlined call.
static bool addArgumentAttrsFromCallsites(Function &F) {
- if (!EnableNonnullArgPropagation)
- return false;
-
bool Changed = false;
// For an argument attribute to transfer from a callsite to the parent, the
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52635.167404.patch
Type: text/x-patch
Size: 1836 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180927/4407c8dd/attachment.bin>
More information about the llvm-commits
mailing list