passes: don't treat frame dead at landing pad
Treating the frame dead at a landing pad is problematic: at
least, function results need to be live, in case there is a
deferred function that recovers.
Change-Id: Ifb3f88ccb0d6cc30b3d09a1190f2c69fa3bd086e
Reviewed-on: https://go-review.googlesource.com/c/153439
Reviewed-by: Than McIntosh <thanm@google.com>
diff --git a/passes/GoStatepoints.cpp b/passes/GoStatepoints.cpp
index c303582..46c08d7 100644
--- a/passes/GoStatepoints.cpp
+++ b/passes/GoStatepoints.cpp
@@ -2435,10 +2435,8 @@
Data.LiveSet[&BB].clear();
computeLiveInValues(BB.rbegin(), BB.rend(), Data.LiveSet[&BB], AddrTakenAllocas, DVCache);
computeAllocaDefs(BB.begin(), BB.end(), Data.AllocaDefSet[&BB], Data.AllocaKillSet[&BB], DVCache);
- if (!BB.isLandingPad()) {
- Data.AllocaDefAny[&BB] = Data.AllocaDefSet[&BB];
- Data.AllocaDefAny[&BB].set_subtract(Data.AllocaKillSet[&BB]);
- }
+ Data.AllocaDefAny[&BB] = Data.AllocaDefSet[&BB];
+ Data.AllocaDefAny[&BB].set_subtract(Data.AllocaKillSet[&BB]);
Data.LiveOut[&BB] = SetVector<Value *>();
computeLiveOutSeed(&BB, Data.LiveOut[&BB], DVCache);
@@ -2453,13 +2451,6 @@
while (changed) {
changed = false;
for (BasicBlock &BB : F) {
- // Don't propagate through landing pad. The whole frame is
- // essentially dead when an exception is thrown.
- if (BB.isLandingPad()) {
- assert(Data.AllocaDefAny[&BB].empty());
- continue;
- }
-
unsigned OldSize = Data.AllocaDefAny[&BB].size();
for (BasicBlock *Pred : predecessors(&BB))
Data.AllocaDefAny[&BB].set_union(Data.AllocaDefAny[Pred]);
@@ -2531,9 +2522,6 @@
SetVector<Value *> LiveOut = Data.LiveOut[BB];
const auto OldLiveOutSize = LiveOut.size();
for (BasicBlock *Succ : successors(BB)) {
- if (Succ->isLandingPad())
- // Don't propagate through landing pad. The frame should be dead at this point.
- continue;
assert(Data.LiveIn.count(Succ));
LiveOut.set_union(Data.LiveIn[Succ]);
}