[PATCH] Add isConstant argument to MDBuilder::createTBAAStructTagNode

Artur Pilipenko apilipenko at azulsystems.com
Mon Jun 1 06:27:16 PDT 2015


http://reviews.llvm.org/D10160

Files:
  include/llvm/IR/MDBuilder.h
  lib/IR/MDBuilder.cpp

Index: include/llvm/IR/MDBuilder.h
===================================================================
--- include/llvm/IR/MDBuilder.h
+++ include/llvm/IR/MDBuilder.h
@@ -153,7 +153,7 @@
   /// \brief Return metadata for a TBAA tag node with the given
   /// base type, access type and offset relative to the base type.
   MDNode *createTBAAStructTagNode(MDNode *BaseType, MDNode *AccessType,
-                                  uint64_t Offset);
+                                  uint64_t Offset, bool IsConstant = false);
 };
 
 } // end namespace llvm
Index: lib/IR/MDBuilder.cpp
===================================================================
--- lib/IR/MDBuilder.cpp
+++ lib/IR/MDBuilder.cpp
@@ -168,9 +168,16 @@
 /// \brief Return metadata for a TBAA tag node with the given
 /// base type, access type and offset relative to the base type.
 MDNode *MDBuilder::createTBAAStructTagNode(MDNode *BaseType, MDNode *AccessType,
-                                           uint64_t Offset) {
+                                           uint64_t Offset, bool IsConstant) {
   Type *Int64 = Type::getInt64Ty(Context);
-  Metadata *Ops[3] = {BaseType, AccessType,
-                      createConstant(ConstantInt::get(Int64, Offset))};
-  return MDNode::get(Context, Ops);
+  if (IsConstant) {
+    Metadata *Ops[4] = {BaseType, AccessType,
+                        createConstant(ConstantInt::get(Int64, Offset)),
+                        createConstant(ConstantInt::get(Int64, 1))};
+    return MDNode::get(Context, Ops);
+  } else {
+    Metadata *Ops[3] = {BaseType, AccessType,
+                        createConstant(ConstantInt::get(Int64, Offset))};
+    return MDNode::get(Context, Ops);
+  }
 }

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10160.26898.patch
Type: text/x-patch
Size: 1707 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150601/bea38939/attachment.bin>


More information about the llvm-commits mailing list