[PATCH] D17467: Instructions: add missing anchors. NFC

Visoiu Mistrih Francis via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 19 16:22:34 PST 2016


thegameg created this revision.
thegameg added reviewers: pete, rnk.
thegameg added a subscriber: llvm-commits.

FCmpInst, ExtractValueInst and InsertValueInst have no anchor functions. This
causes the vtable and the type info (if RTTI is enabled in user code) to
be emitted in multiple translation units (and the Coding Standards
enforce the presence of an anchor method).

The problem has occured here:
http://lists.llvm.org/pipermail/llvm-dev/2016-February/095654.html

http://reviews.llvm.org/D17467

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

Index: lib/IR/Instructions.cpp
===================================================================
--- lib/IR/Instructions.cpp
+++ lib/IR/Instructions.cpp
@@ -1820,6 +1820,8 @@
 //                             InsertValueInst Class
 //===----------------------------------------------------------------------===//
 
+void InsertValueInst::anchor() {}
+
 void InsertValueInst::init(Value *Agg, Value *Val, ArrayRef<unsigned> Idxs, 
                            const Twine &Name) {
   assert(getNumOperands() == 2 && "NumOperands not initialized?");
@@ -1852,6 +1854,8 @@
 //                             ExtractValueInst Class
 //===----------------------------------------------------------------------===//
 
+void ExtractValueInst::anchor() {}
+
 void ExtractValueInst::init(ArrayRef<unsigned> Idxs, const Twine &Name) {
   assert(getNumOperands() == 1 && "NumOperands not initialized?");
 
@@ -3577,6 +3581,8 @@
   }
 }
 
+void FCmpInst::anchor() {}
+
 
 //===----------------------------------------------------------------------===//
 //                        SwitchInst Implementation
Index: include/llvm/IR/Instructions.h
===================================================================
--- include/llvm/IR/Instructions.h
+++ include/llvm/IR/Instructions.h
@@ -1247,6 +1247,8 @@
 /// vectors of floating point values. The operands must be identical types.
 /// \brief Represents a floating point comparison operator.
 class FCmpInst: public CmpInst {
+  void anchor() override;
+
 protected:
   // Note: Instruction needs to be a friend here to call cloneImpl.
   friend class Instruction;
@@ -2188,6 +2190,8 @@
 class ExtractValueInst : public UnaryInstruction {
   SmallVector<unsigned, 4> Indices;
 
+  void anchor() override;
+
   ExtractValueInst(const ExtractValueInst &EVI);
   void init(ArrayRef<unsigned> Idxs, const Twine &NameStr);
 
@@ -2297,6 +2301,8 @@
 class InsertValueInst : public Instruction {
   SmallVector<unsigned, 4> Indices;
 
+  void anchor() override;
+
   void *operator new(size_t, unsigned) = delete;
   InsertValueInst(const InsertValueInst &IVI);
   void init(Value *Agg, Value *Val, ArrayRef<unsigned> Idxs,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17467.48555.patch
Type: text/x-patch
Size: 2150 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160220/cff176cb/attachment.bin>


More information about the llvm-commits mailing list