mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-20 11:29:24 +00:00
bug 122:
- Replace ConstantPointerRef usage with GlobalValue usage - Correct test ordering for GlobalValue subclass git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14943 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e840434755
commit
d02fccfdb8
@ -528,8 +528,6 @@ bool RPR::PeepholeOptimize(BasicBlock *BB, BasicBlock::iterator &BI) {
|
|||||||
Constant *ConstantCallSrc = 0;
|
Constant *ConstantCallSrc = 0;
|
||||||
if (Constant *CS = dyn_cast<Constant>(CI->getCalledValue()))
|
if (Constant *CS = dyn_cast<Constant>(CI->getCalledValue()))
|
||||||
ConstantCallSrc = CS;
|
ConstantCallSrc = CS;
|
||||||
else if (GlobalValue *GV = dyn_cast<GlobalValue>(CI->getCalledValue()))
|
|
||||||
ConstantCallSrc = ConstantPointerRef::get(GV);
|
|
||||||
|
|
||||||
if (ConstantCallSrc)
|
if (ConstantCallSrc)
|
||||||
NewCast = ConstantExpr::getCast(ConstantCallSrc, NewPFunTy);
|
NewCast = ConstantExpr::getCast(ConstantCallSrc, NewPFunTy);
|
||||||
@ -537,10 +535,6 @@ bool RPR::PeepholeOptimize(BasicBlock *BB, BasicBlock::iterator &BI) {
|
|||||||
NewCast = new CastInst(CI->getCalledValue(), NewPFunTy,
|
NewCast = new CastInst(CI->getCalledValue(), NewPFunTy,
|
||||||
CI->getCalledValue()->getName()+"_c",CI);
|
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...
|
// Create a new call instruction...
|
||||||
CallInst *NewCall = new CallInst(NewCast,
|
CallInst *NewCall = new CallInst(NewCast,
|
||||||
std::vector<Value*>(CI->op_begin()+1, CI->op_end()));
|
std::vector<Value*>(CI->op_begin()+1, CI->op_end()));
|
||||||
|
Loading…
Reference in New Issue
Block a user