[llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp

Reid Spencer reid at x10sys.com
Sun Jan 22 23:39:15 PST 2006



Changes in directory llvm/lib/Bytecode/Reader:

Reader.cpp updated: 1.180 -> 1.181
---
Log message:

For PR411: http://llvm.cs.uiuc.edu/PR411 :
Don't try to be smart about fixing intrinsic functions when they're read
in, just fix them after the module is read when all names are resolved.


---
Diffs of the changes:  (+5 -14)

 Reader.cpp |   19 +++++--------------
 1 files changed, 5 insertions(+), 14 deletions(-)


Index: llvm/lib/Bytecode/Reader/Reader.cpp
diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.180 llvm/lib/Bytecode/Reader/Reader.cpp:1.181
--- llvm/lib/Bytecode/Reader/Reader.cpp:1.180	Thu Jan 19 01:02:16 2006
+++ llvm/lib/Bytecode/Reader/Reader.cpp	Mon Jan 23 01:39:03 2006
@@ -1033,13 +1033,6 @@
 
   BB->getInstList().push_back(Result);
 
-  if (this->hasUpgradedIntrinsicFunctions && isCall)
-    if (Instruction* inst = UpgradeIntrinsicCall(cast<CallInst>(Result))) {
-      Result->replaceAllUsesWith(inst);
-      Result->eraseFromParent();
-      Result = inst;
-    }
-
   unsigned TypeSlot;
   if (Result->getType() == InstTy)
     TypeSlot = iType;
@@ -2032,13 +2025,6 @@
     Function *Func = new Function(FTy, GlobalValue::ExternalLinkage,
                                   "", TheModule);
 
-    // Replace with upgraded intrinsic function, if applicable.
-    if (Function* upgrdF = UpgradeIntrinsicFunction(Func)) {
-      hasUpgradedIntrinsicFunctions = true;
-      Func->eraseFromParent();
-      Func = upgrdF;
-    }
-
     insertValue(Func, (FnSignature & (~0U >> 1)) >> 5, ModuleValues);
 
     // Flags are not used yet.
@@ -2402,6 +2388,11 @@
     // Parse the module contents
     this->ParseModule();
 
+    // Look for intrinsic functions and CallInst that need to be upgraded
+    for (Module::iterator FI = TheModule->begin(), FE = TheModule->end();
+         FI != FE; ++FI)
+      UpgradeCallsToIntrinsic(FI);
+
     // Check for missing functions
     if (hasFunctions())
       error("Function expected, but bytecode stream ended!");






More information about the llvm-commits mailing list