summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/Linker.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-07-30 18:54:22 +0000
committerChris Lattner <sabre@nondot.org>2002-07-30 18:54:22 +0000
commita13a2dac7eebbbe5e9c31966329a208201e6cb3c (patch)
tree4c4e40c42b8b5e5d161aa0d1cacb63ff67f1694a /llvm/lib/Transforms/Utils/Linker.cpp
parent6bb917f083955071dc8de22fde16504df9d3e9e3 (diff)
downloadbcm5719-llvm-a13a2dac7eebbbe5e9c31966329a208201e6cb3c.tar.gz
bcm5719-llvm-a13a2dac7eebbbe5e9c31966329a208201e6cb3c.zip
Cleanup ConstantExpr handling:
* Correctly delete TypeHandles in AsmParser. In addition to not leaking memory, this prevents a bug that could have occurred when a type got resolved that the constexpr was using * Check for errors in the AsmParser instead of hitting assertion failures deep in the code * Simplify the interface to the ConstantExpr class, removing unneccesary parameters to the ::get* methods. * Rename the 'getelementptr' version of ConstantExpr::get to ConstantExpr::getGetElementPtr llvm-svn: 3160
Diffstat (limited to 'llvm/lib/Transforms/Utils/Linker.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/Linker.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/Utils/Linker.cpp b/llvm/lib/Transforms/Utils/Linker.cpp
index d8f67ff1aad..48e40d0b3d9 100644
--- a/llvm/lib/Transforms/Utils/Linker.cpp
+++ b/llvm/lib/Transforms/Utils/Linker.cpp
@@ -11,15 +11,10 @@
#include "llvm/Transforms/Utils/Linker.h"
#include "llvm/Module.h"
-#include "llvm/Function.h"
-#include "llvm/BasicBlock.h"
-#include "llvm/GlobalVariable.h"
#include "llvm/SymbolTable.h"
#include "llvm/DerivedTypes.h"
#include "llvm/iOther.h"
#include "llvm/Constants.h"
-#include "llvm/Argument.h"
-#include <iostream>
using std::cerr;
using std::string;
using std::map;
@@ -134,7 +129,7 @@ static Value *RemapOperand(const Value *In, map<const Value*, Value*> &LocalMap,
Value *V2 = RemapOperand(CE->getOperand(1), LocalMap, GlobalMap);
Result = ConstantExpr::get(CE->getOpcode(), cast<Constant>(V1),
- cast<Constant>(V2), CE->getType());
+ cast<Constant>(V2));
} else {
// GetElementPtr Expression
assert(CE->getOpcode() == Instruction::GetElementPtr);
@@ -145,8 +140,7 @@ static Value *RemapOperand(const Value *In, map<const Value*, Value*> &LocalMap,
Indices.push_back(cast<Constant>(RemapOperand(CE->getOperand(i),
LocalMap, GlobalMap)));
- Result = ConstantExpr::get(CE->getOpcode(), cast<Constant>(Ptr),
- Indices, CE->getType());
+ Result = ConstantExpr::getGetElementPtr(cast<Constant>(Ptr), Indices);
}
} else {
OpenPOWER on IntegriCloud