Kill every call to @clang.arc.use in the ARC contract phase.
[oota-llvm.git] / lib / Transforms / ObjCARC / ObjCARCContract.cpp
index 704ac920bd1e5be23a0d2238106f7be26903877e..5d0865e8bea2bf6dad3edc05e5c2489437c7640e 100644 (file)
@@ -1,4 +1,4 @@
-//===- ObjCARCOpts.cpp - ObjC ARC Optimization ----------------------------===//
+//===- ObjCARCContract.cpp - ObjC ARC Optimization ------------------------===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -11,6 +11,9 @@
 /// Reference Counting and is a system for managing reference counts for objects
 /// in Objective C.
 ///
+/// This specific file mainly deals with ``contracting'' multiple lower level
+/// operations into singular higher level operations through pattern matching.
+///
 /// WARNING: This file knows about certain library functions. It recognizes them
 /// by name, and hardwires knowledge of their semantics.
 ///
 
 #define DEBUG_TYPE "objc-arc-contract"
 #include "ObjCARC.h"
-#include "ProvenanceAnalysis.h"
 #include "DependencyAnalysis.h"
-
+#include "ProvenanceAnalysis.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/Analysis/Dominators.h"
 #include "llvm/IR/InlineAsm.h"
 #include "llvm/IR/Operator.h"
+#include "llvm/Support/Debug.h"
 
 using namespace llvm;
 using namespace llvm::objcarc;
@@ -450,6 +453,10 @@ bool ObjCARCContract::runOnFunction(Function &F) {
       if (isa<AllocaInst>(Inst))
         TailOkForStoreStrongs = false;
       continue;
+    case IC_IntrinsicUser:
+      // Remove calls to @clang.arc.use(...).
+      Inst->eraseFromParent();
+      continue;
     default:
       continue;
     }
@@ -532,6 +539,3 @@ bool ObjCARCContract::runOnFunction(Function &F) {
 
   return Changed;
 }
-
-/// @}
-///