diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2006-11-27 01:05:10 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2006-11-27 01:05:10 +0000 |
commit | 6c38f0bb071b864a6f2ae7b0cacad1b15f6e3d03 (patch) | |
tree | 49fc8d5bca4b3574ae62d6927eef8e54ec07afb2 /llvm/lib/Transforms/IPO/RaiseAllocations.cpp | |
parent | afbc00bc381d60d041d716e0f9b8a04aadb42d23 (diff) | |
download | bcm5719-llvm-6c38f0bb071b864a6f2ae7b0cacad1b15f6e3d03.tar.gz bcm5719-llvm-6c38f0bb071b864a6f2ae7b0cacad1b15f6e3d03.zip |
For PR950:
The long awaited CAST patch. This introduces 12 new instructions into LLVM
to replace the cast instruction. Corresponding changes throughout LLVM are
provided. This passes llvm-test, llvm/test, and SPEC CPUINT2000 with the
exception of 175.vpr which fails only on a slight floating point output
difference.
llvm-svn: 31931
Diffstat (limited to 'llvm/lib/Transforms/IPO/RaiseAllocations.cpp')
-rw-r--r-- | llvm/lib/Transforms/IPO/RaiseAllocations.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/IPO/RaiseAllocations.cpp b/llvm/lib/Transforms/IPO/RaiseAllocations.cpp index 188b7f527f4..584a2e98b09 100644 --- a/llvm/lib/Transforms/IPO/RaiseAllocations.cpp +++ b/llvm/lib/Transforms/IPO/RaiseAllocations.cpp @@ -140,7 +140,9 @@ bool RaiseAllocations::runOnModule(Module &M) { // If no prototype was provided for malloc, we may need to cast the // source size. if (Source->getType() != Type::UIntTy) - Source = new CastInst(Source, Type::UIntTy, "MallocAmtCast", I); + Source = + CastInst::createInferredCast(Source, Type::UIntTy, + "MallocAmtCast", I); std::string Name(I->getName()); I->setName(""); MallocInst *MI = new MallocInst(Type::SByteTy, Source, Name, I); @@ -160,7 +162,7 @@ bool RaiseAllocations::runOnModule(Module &M) { Users.insert(Users.end(), GV->use_begin(), GV->use_end()); EqPointers.push_back(GV); } else if (ConstantExpr *CE = dyn_cast<ConstantExpr>(U)) { - if (CE->getOpcode() == Instruction::Cast) { + if (CE->isCast()) { Users.insert(Users.end(), CE->use_begin(), CE->use_end()); EqPointers.push_back(CE); } @@ -191,8 +193,8 @@ bool RaiseAllocations::runOnModule(Module &M) { // Value *Source = *CS.arg_begin(); if (!isa<PointerType>(Source->getType())) - Source = new CastInst(Source, PointerType::get(Type::SByteTy), - "FreePtrCast", I); + Source = CastInst::createInferredCast( + Source, PointerType::get(Type::SByteTy), "FreePtrCast", I); new FreeInst(Source, I); // If the old instruction was an invoke, add an unconditional branch @@ -211,7 +213,7 @@ bool RaiseAllocations::runOnModule(Module &M) { Users.insert(Users.end(), GV->use_begin(), GV->use_end()); EqPointers.push_back(GV); } else if (ConstantExpr *CE = dyn_cast<ConstantExpr>(U)) { - if (CE->getOpcode() == Instruction::Cast) { + if (CE->isCast()) { Users.insert(Users.end(), CE->use_begin(), CE->use_end()); EqPointers.push_back(CE); } |