diff options
author | Chris Lattner <sabre@nondot.org> | 2004-02-09 00:20:55 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-02-09 00:20:55 +0000 |
commit | 57ea2e3294ffe2a68dbbfed6eed08b1ae3fe899b (patch) | |
tree | 76a38bce20117366e00fad14162bf42f46150806 /llvm/lib/Transforms | |
parent | 5b6892e37c8d138527d395bab22006e9b3c3427a (diff) | |
download | bcm5719-llvm-57ea2e3294ffe2a68dbbfed6eed08b1ae3fe899b.tar.gz bcm5719-llvm-57ea2e3294ffe2a68dbbfed6eed08b1ae3fe899b.zip |
The ConstantExpr::getCast call can cause a CPR to be generated. If so,
strip it off.
llvm-svn: 11213
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/LevelRaise.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/LevelRaise.cpp b/llvm/lib/Transforms/LevelRaise.cpp index c128688da2f..12268edbeda 100644 --- a/llvm/lib/Transforms/LevelRaise.cpp +++ b/llvm/lib/Transforms/LevelRaise.cpp @@ -539,6 +539,10 @@ bool RPR::PeepholeOptimize(BasicBlock *BB, BasicBlock::iterator &BI) { NewCast = new CastInst(CI->getCalledValue(), NewPFunTy, CI->getCalledValue()->getName()+"_c",CI); + // Strip off unneeded CPR's. + if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(NewCast)) + NewCast = CPR->getValue(); + // Create a new call instruction... CallInst *NewCall = new CallInst(NewCast, std::vector<Value*>(CI->op_begin()+1, CI->op_end())); |