Here's a stab at removing these unnecessary post-call stack adjustments.
Details
Diff Detail
Event Timeline
include/llvm/Target/TargetLowering.h | ||
---|---|---|
2525 | Call can be an invoke, in which case it terminates, in which case this may call isa<> on an end iterator, which is bad. I think the easy way to avoid this case is check for !Call.isInvoke() && .... | |
lib/Target/X86/X86ISelLowering.cpp | ||
3384 | We should kill that TargetOption eventually... |
include/llvm/Target/TargetLowering.h | ||
---|---|---|
2525 | Instead of isa<UnreachableInst>(++Call.getInstruction()->getIterator()) you could do isa<UnreachableInst>(Call.getInstruction()->getNextNode()) which is a little shorter (and simpler IMO). |
include/llvm/Target/TargetLowering.h | ||
---|---|---|
2525 | I think you have to null check getNextNode, though. |
It looks like we still have this problem, despite many attempts to fix it. rG5b79e603d3b7a29940df6580d6f62b0e9bd339c0 / D66905, for example.
If you enable exceptions, my checks aren't enough. This C++ code for example:
struct MakeCleanup { ~MakeCleanup(); }; bool cond(); void foo() { MakeCleanup o; if (cond()) throw; if (cond()) throw; }
I think we should look into removing this x86isellowering code.
Call can be an invoke, in which case it terminates, in which case this may call isa<> on an end iterator, which is bad. I think the easy way to avoid this case is check for !Call.isInvoke() && ....