mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-25 16:24:23 +00:00
final step needed to resolve PR6627, which allows us to flatten the code down to
a nice and tidy: %x1 = load i32* %0, align 4 %1 = icmp eq i32 %x1, 1179403647 br i1 %1, label %if.then, label %if.end instead of doing lots of loads and branches. May the FreeBSD bootloader long fit in its allocated space. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130416 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -432,14 +432,14 @@ namespace {
|
||||
/// addToLeaderTable - Push a new Value to the LeaderTable onto the list for
|
||||
/// its value number.
|
||||
void addToLeaderTable(uint32_t N, Value *V, BasicBlock *BB) {
|
||||
LeaderTableEntry& Curr = LeaderTable[N];
|
||||
LeaderTableEntry &Curr = LeaderTable[N];
|
||||
if (!Curr.Val) {
|
||||
Curr.Val = V;
|
||||
Curr.BB = BB;
|
||||
return;
|
||||
}
|
||||
|
||||
LeaderTableEntry* Node = TableAllocator.Allocate<LeaderTableEntry>();
|
||||
LeaderTableEntry *Node = TableAllocator.Allocate<LeaderTableEntry>();
|
||||
Node->Val = V;
|
||||
Node->BB = BB;
|
||||
Node->Next = Curr.Next;
|
||||
@ -944,7 +944,10 @@ static Value *GetLoadValueForLoad(LoadInst *SrcVal, unsigned Offset,
|
||||
|
||||
Value *PtrVal = SrcVal->getPointerOperand();
|
||||
|
||||
IRBuilder<> Builder(SrcVal->getParent(), SrcVal);
|
||||
// Insert the new load after the old load. This ensures that subsequent
|
||||
// memdep queries will find the new load. We can't easily remove the old
|
||||
// load completely because it is already in the value numbering table.
|
||||
IRBuilder<> Builder(SrcVal->getParent(), ++BasicBlock::iterator(SrcVal));
|
||||
const Type *DestPTy =
|
||||
IntegerType::get(LoadTy->getContext(), NewLoadSize*8);
|
||||
DestPTy = PointerType::get(DestPTy,
|
||||
@ -967,6 +970,7 @@ static Value *GetLoadValueForLoad(LoadInst *SrcVal, unsigned Offset,
|
||||
RV = Builder.CreateTrunc(RV, SrcVal->getType());
|
||||
SrcVal->replaceAllUsesWith(RV);
|
||||
gvn.getMemDep().removeInstruction(SrcVal);
|
||||
//gvn.markInstructionForDeletion(SrcVal);
|
||||
SrcVal = NewLoad;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user