Avoid unnecessary string construction during asm printing.
[oota-llvm.git] / lib / CodeGen / ShadowStackCollector.cpp
index d41e83c712de7f6ad47f69dbc0f44f4501d7518e..568fe44c30ec6e31a1b253c21f6ac5b447d1508a 100644 (file)
@@ -66,11 +66,14 @@ namespace {
     static GetElementPtrInst *CreateGEP(IRBuilder &B, Value *BasePtr,
                                         int Idx1, int Idx2, const char *Name);
   };
+
+}
   
-  CollectorRegistry::Add<ShadowStackCollector>
-  Y("shadow-stack",
-    "Very portable collector for uncooperative code generators");
+static CollectorRegistry::Add<ShadowStackCollector>
+Y("shadow-stack",
+  "Very portable collector for uncooperative code generators");
   
+namespace {
   /// EscapeEnumerator - This is a little algorithm to find all escape points
   /// from a function so that "finally"-style code can be inserted. In addition
   /// to finding the existing return and unwind instructions, it also (if
@@ -325,8 +328,7 @@ void ShadowStackCollector::CollectRoots(Function &F) {
         if (Function *F = CI->getCalledFunction())
           if (F->getIntrinsicID() == Intrinsic::gcroot) {
             std::pair<CallInst*,AllocaInst*> Pair = std::make_pair(
-              CI, cast<AllocaInst>(
-                    IntrinsicInst::StripPointerCasts(CI->getOperand(1))));
+              CI, cast<AllocaInst>(CI->getOperand(1)->stripPointerCasts()));
             if (IsNullValue(CI->getOperand(2)))
               Roots.push_back(Pair);
             else