mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-25 16:24:23 +00:00
alternate fix for PR5258 which avoids worklist problems, with reduced testcase.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84667 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -177,19 +177,14 @@ Value *SSAUpdater::GetValueInMiddleOfBlock(BasicBlock *BB) {
|
||||
/// which use their value in the corresponding predecessor.
|
||||
void SSAUpdater::RewriteUse(Use &U) {
|
||||
Instruction *User = cast<Instruction>(U.getUser());
|
||||
BasicBlock *UseBB = User->getParent();
|
||||
PHINode *UserPN = dyn_cast<PHINode>(User);
|
||||
if (UserPN)
|
||||
UseBB = UserPN->getIncomingBlock(U);
|
||||
|
||||
Value *V;
|
||||
if (PHINode *UserPN = dyn_cast<PHINode>(User))
|
||||
V = GetValueAtEndOfBlock(UserPN->getIncomingBlock(U));
|
||||
else
|
||||
V = GetValueInMiddleOfBlock(User->getParent());
|
||||
|
||||
Value *V = GetValueInMiddleOfBlock(UseBB);
|
||||
U.set(V);
|
||||
if (UserPN) {
|
||||
// Incoming value from the same BB must be consistent
|
||||
for (unsigned i=0;i<UserPN->getNumIncomingValues();i++)
|
||||
if (UserPN->getIncomingBlock(i) == UseBB)
|
||||
UserPN->setIncomingValue(i, V);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user