[PATCH] D17598: [LIR] Set attributes on memset_pattern16.

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


ab retitled this revision from "Use the same attributes as "memset" when introducing a call to memset_pattern in LoopIdiom" to "[LIR] Set attributes on memset_pattern16.".
ab updated this revision to Diff 54810.
ab added dependencies: D19471: [TLI] Mark memset_pattern16 params nocapture., D19470: [TLI] Unify LibFunc attribute inference. NFCI..
ab added a comment.

Now that we have a unified way of setting attributes, use it.

Depends on http://reviews.llvm.org/D19470 and http://reviews.llvm.org/D19471.


http://reviews.llvm.org/D17598

Files:
  lib/Transforms/Scalar/LoopIdiomRecognize.cpp
  test/Transforms/LoopIdiom/basic.ll

Index: test/Transforms/LoopIdiom/basic.ll
===================================================================
--- test/Transforms/LoopIdiom/basic.ll
+++ test/Transforms/LoopIdiom/basic.ll
@@ -564,3 +564,7 @@
 ; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* %X, i8 0, i64 10000, i32 1, i1 false)
 ; CHECK: ret void
 }
+
+; Validate that "memset_pattern" has the proper attributes.
+; CHECK: declare void @memset_pattern16(i8* nocapture, i8* nocapture readonly, i64) [[ATTRS:#[0-9]+]]
+; CHECK: [[ATTRS]] = { argmemonly }
Index: lib/Transforms/Scalar/LoopIdiomRecognize.cpp
===================================================================
--- lib/Transforms/Scalar/LoopIdiomRecognize.cpp
+++ lib/Transforms/Scalar/LoopIdiomRecognize.cpp
@@ -53,6 +53,7 @@
 #include "llvm/IR/Module.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
+#include "llvm/Transforms/Utils/BuildLibCalls.h"
 #include "llvm/Transforms/Utils/Local.h"
 #include "llvm/Transforms/Utils/LoopUtils.h"
 using namespace llvm;
@@ -769,6 +770,7 @@
     Value *MSP =
         M->getOrInsertFunction("memset_pattern16", Builder.getVoidTy(),
                                Int8PtrTy, Int8PtrTy, IntPtr, (void *)nullptr);
+    inferLibFuncAttributes(*M->getFunction("memset_pattern16"), *TLI);
 
     // Otherwise we should form a memset_pattern16.  PatternValue is known to be
     // an constant array of 16-bytes.  Plop the value into a mergable global.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17598.54810.patch
Type: text/x-patch
Size: 1446 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160424/7270d029/attachment-0001.bin>


More information about the llvm-commits mailing list