aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-11-21 14:14:25 -0800
committerAlon Zakai <alonzakai@gmail.com>2011-11-21 14:14:25 -0800
commitbb21572ed8cb96d5abc9f295f072202c074d55b5 (patch)
treee07e036a780cbd9f27b89f0d813d5fe20e2385fb
parentf13a917368638c051ddf362612d79e12af5d4086 (diff)
properly handle branches to phi from invokes in assigns
-rw-r--r--src/analyzer.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/analyzer.js b/src/analyzer.js
index d8439a99..d0c3cb71 100644
--- a/src/analyzer.js
+++ b/src/analyzer.js
@@ -628,7 +628,8 @@ function analyzer(data) {
var sourceLabelId = phi.params[i].label;
var sourceLabel = func.labelsDict[sourceLabelId];
var lastLine = sourceLabel.lines.slice(-1)[0];
- assert(lastLine.intertype in LLVM.PHI_REACHERS, 'Only some can lead to labels with phis, line ' + [func.ident, label.ident]);
+ if (lastLine.intertype == 'assign') lastLine = lastLine.value;
+ assert(lastLine.intertype in LLVM.PHI_REACHERS, 'Only some can lead to labels with phis:' + [func.ident, label.ident, lastLine.intertype]);
lastLine.currLabelId = sourceLabelId;
}
phis.push(line);
@@ -671,7 +672,8 @@ function analyzer(data) {
var sourceLabelId = param.label;
var sourceLabel = func.labelsDict[sourceLabelId];
var lastLine = sourceLabel.lines.slice(-1)[0];
- assert(lastLine.intertype in LLVM.PHI_REACHERS, 'Only some can lead to labels with phis, line ' + [func.ident, label.ident]);
+ if (lastLine.intertype == 'assign') lastLine = lastLine.value;
+ assert(lastLine.intertype in LLVM.PHI_REACHERS, 'Only some can lead to labels with phis:' + [func.ident, label.ident, lastLine.intertype]);
if (!lastLine.phi) {
lastLine.phi = true;
assert(!lastLine.dependent);