[PATCH] Add comdat key field to llvm.global_ctors and llvm.global_dtors

Saleem Abdulrasool compnerd at compnerd.org
Wed May 7 19:09:25 PDT 2014


================
Comment at: include/llvm/Target/TargetLoweringObjectFile.h:142
@@ -141,1 +141,3 @@
+                       const MCSection *KeySec = 0) const {
+    (void)KeySym;
     return StaticDtorSection;
----------------
Why the cast to void to silence an unused variable warning for KeySym but not for KeySec nor Priority?  You dont seem to do the same for the getStaticCtorSection.  What is special about the KeySym parameter here?

================
Comment at: lib/CodeGen/AsmPrinter/AsmPrinter.cpp:1301
@@ +1300,3 @@
+struct Structor {
+  Structor() : Priority(0), Func(0), ComdatKey(0) {}
+  int Priority;
----------------
Can you use nullptr or NULL for the pointers in the initializer list please.

================
Comment at: lib/IR/Verifier.cpp:413
@@ +412,3 @@
+      if (STy->getNumElements() == 3) {
+        Type *ETy = STy->getTypeAtIndex(2);
+        Assert1(ETy->isPointerTy() &&
----------------
This is going to cause a warning on non-assert builds wont it?  Perhaps use a DEBUG_ONLY wrapper around this?

================
Comment at: lib/IR/Verifier.cpp:415
@@ +414,3 @@
+        Assert1(ETy->isPointerTy() &&
+                    cast<PointerType>(ETy)->getElementType()->isIntegerTy(8),
+                "wrong type for intrinsic global variable", &GV);
----------------
Shouldnt this be aligned with ETy?

http://reviews.llvm.org/D3499






More information about the llvm-commits mailing list