Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function deleted in an error #1816

Closed
asl opened this issue May 23, 2007 · 5 comments
Closed

Function deleted in an error #1816

asl opened this issue May 23, 2007 · 5 comments
Labels
bugzilla Issues migrated from bugzilla llvm:codegen

Comments

@asl
Copy link
Collaborator

asl commented May 23, 2007

Bugzilla Link 1444
Resolution FIXED
Resolved on Feb 22, 2010 12:55
Version trunk
OS Linux
Attachments Testcase

Extended Description

Consider attached testcase.

Run llc via "./llc -enable-eh". You'll see, that _Z17handle_unexpected function
is dropped from the generated assembly. This is horrible bad :(. Everything is
ok with "-fast". Almost surely the problem is due to "unreachable" inst in the
"invcont16" BB (note, that cxa_throw will always throw, so the code is correct).

@llvmbot
Copy link
Collaborator

llvmbot commented May 24, 2007

This is a branch folding/tail merge problem, mine.

@llvmbot
Copy link
Collaborator

llvmbot commented May 24, 2007

I believe the following patch fixes it, could you try? The resulting executable doesn't work on Darwin
but the eh layout may well be different...

Index: BranchFolding.cpp

====
RCS file: /var/cvs/llvm/llvm/lib/CodeGen/BranchFolding.cpp,v
retrieving revision 1.56
diff -u -b -r1.56 BranchFolding.cpp
--- BranchFolding.cpp 23 May 2007 21:07:20 -0000 1.56
+++ BranchFolding.cpp 23 May 2007 23:58:37 -0000
@@ -717,11 +717,19 @@
I->getOperand(i).setMachineBasicBlock(New);
}

  • // Update the successor information.
  • // Update the successor information. If New was already a successor, just
  • // remove the link to Old instead of creating another one. PR 1444.
  • bool HadSuccessorNew = false;
    std::vector<MachineBasicBlock*> Succs(BB->succ_begin(), BB->succ_end());
    for (int i = Succs.size()-1; i >= 0; --i)
  • if (Succs[i] == New) {
  •  HadSuccessorNew = true;
    
  •  break;
    
  • }
  • for (int i = Succs.size()-1; i >= 0; --i)
    if (Succs[i] == Old) {
    BB->removeSuccessor(Old);
  •  if (!HadSuccessorNew)
     BB->addSuccessor(New);
    
    }
    }

@asl
Copy link
Collaborator Author

asl commented May 24, 2007

This patch works, thanks, Dale!

@llvmbot
Copy link
Collaborator

llvmbot commented May 25, 2007

I was hoping that this would fix #1794 as well, which seems to be
a similar kind of problem, but unfortunately it didn't.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla llvm:codegen
Projects
None yet
Development

No branches or pull requests

2 participants