[PATCH] D93189: Introduce the `!nocapture` metadata and "nocapture_use" operand bundle
Juneyoung Lee via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 7 16:45:53 PST 2021
aqjune added a comment.
I have a question - is it possible to have the same optimization power with !nocapture only? In other words, is it purely for making analysis flow-insensitive?
We can define that it is undefined behavior for any function calls after this store to load the pointer and capture it.
================
Comment at: llvm/docs/LangRef.rst:2336
+was stoed to. Since the store is not capturing the pointer anymore, due to
+``!nocapture``, we need to make the potential use explicitl.
+
----------------
nit: typos (stoed, explicitl)
================
Comment at: llvm/test/Transforms/InstCombine/nocapture_use.ll:21
+ %tmp3 = bitcast %struct.S* %s to i8*
+ %tmp4 = bitcast i32* %local to i8*
+ ret i32 %tmp2
----------------
tmp1, tmp3, tmp4 are not needed (similarly below)
================
Comment at: llvm/test/Transforms/InstCombine/nocapture_use.ll:42
+ %tmp4 = bitcast i32* %local to i8*
+ ret i32 %tmp2
+}
----------------
(Orthogonal to this patch) would it be great to explicitly state in LangRef that it is illegal for a function call to return a nocapture pointer? I can make a super short patch for this. @nlopes was also interested in this when implementing nocapture in Alive2.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D93189/new/
https://reviews.llvm.org/D93189
More information about the llvm-commits
mailing list