diff --git a/docs/GarbageCollection.html b/docs/GarbageCollection.html index 4b5bd50aca1..c9324859ba9 100644 --- a/docs/GarbageCollection.html +++ b/docs/GarbageCollection.html @@ -1084,37 +1084,35 @@ href="WritingAnLLVMPass.html#doInitialization_mod">doInitialization(Module
#include "llvm/Module.h"
-#include "llvm/Instructions.h"
+#include "llvm/IntrinsicInst.h"
 
 bool MyCollector::initializeCustomLowering(Module &M) {
   return false;
 }
 
 bool MyCollector::performCustomLowering(Function &F) {
-  const Module *M = F.getParent();
-  
-  Function *GCReadInt  = M->getFunction("llvm.gcread"),
-           *GCWriteInt = M->getFunction("llvm.gcwrite"),
-           *GCRootInt  = M->getFunction("llvm.gcroot");
-  
   bool MadeChange = false;
   
   for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
-    for (BasicBlock::iterator II = BB->begin(), E = BB->end(); II != E;)
-      if (CallInst *CI = dyn_cast<CallInst>(II++))
-        if (Function *F = CI->getCalledFunction())
-          if (F == GCWriteInt) {
+    for (BasicBlock::iterator II = BB->begin(), E = BB->end(); II != E; ++II)
+      if (IntrinsicInst *CI = dyn_cast<IntrinsicInst>(II))
+        if (Function *F = CI->getCalledFunction())
+          switch (F->getIntrinsicID()) {
+          case Intrinsic::gcwrite:
             // Handle llvm.gcwrite.
-            CI->eraseFromParent();
+            CI->eraseFromParent();
             MadeChange = true;
-          } else if (F == GCReadInt) {
+            break;
+          case Intrinsic::gcread:
             // Handle llvm.gcread.
-            CI->eraseFromParent();
+            CI->eraseFromParent();
             MadeChange = true;
-          } else if (F == GCRootInt) {
+            break;
+          case Intrinsic::gcroot:
             // Handle llvm.gcroot.
-            CI->eraseFromParent();
+            CI->eraseFromParent();
             MadeChange = true;
+            break;
           }
   
   return MadeChange;