[PATCH] D19471: [TLI] Mark memset_pattern16 params nocapture.

Ahmed Bougacha via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 24 12:54:41 PDT 2016


ab created this revision.
ab added reviewers: joker.eph, echristo.
ab added a subscriber: llvm-commits.
ab added a dependency: D19470: [TLI] Unify LibFunc attribute inference. NFCI..
Herald added a subscriber: joker.eph.

Noticed while looking at D17598. I think it should also be nothrow, but there are lots of missing attributes already. I'm playing with tablegen so will do another pass over everything. For now, nocapture should help Mehdi.

Depends on D19470.

http://reviews.llvm.org/D19471

Files:
  lib/Transforms/Utils/BuildLibCalls.cpp
  test/Transforms/InferFunctionAttrs/annotate.ll

Index: test/Transforms/InferFunctionAttrs/annotate.ll
===================================================================
--- test/Transforms/InferFunctionAttrs/annotate.ll
+++ test/Transforms/InferFunctionAttrs/annotate.ll
@@ -25,7 +25,7 @@
 
 declare void @memset_pattern16(i8*, i8*, i64)
 ; CHECK: declare void @memset_pattern16(i8*, i8*, i64)
-; CHECK-POSIX: declare void @memset_pattern16(i8*, i8* readonly, i64) [[G2:#[0-9]+]]
+; CHECK-POSIX: declare void @memset_pattern16(i8* nocapture, i8* nocapture readonly, i64) [[G2:#[0-9]+]]
 
 declare i32 @gettimeofday(i8*, i8*)
 ; CHECK-POSIX: declare i32 @gettimeofday(i8* nocapture, i8* nocapture) [[G0:#[0-9]+]]
Index: lib/Transforms/Utils/BuildLibCalls.cpp
===================================================================
--- lib/Transforms/Utils/BuildLibCalls.cpp
+++ lib/Transforms/Utils/BuildLibCalls.cpp
@@ -690,6 +690,8 @@
   //case LibFunc::memset_pattern8:
   case LibFunc::memset_pattern16:
     Changed |= setOnlyAccessesArgMemory(F);
+    Changed |= setDoesNotCapture(F, 1);
+    Changed |= setDoesNotCapture(F, 2);
     Changed |= setOnlyReadsMemory(F, 2);
     return Changed;
   // int __nvvm_reflect(const char *)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19471.54809.patch
Type: text/x-patch
Size: 1185 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160424/93d7acb1/attachment.bin>


More information about the llvm-commits mailing list