summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cfg/liveness-traversal.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/cfg/liveness-traversal.h b/src/cfg/liveness-traversal.h
index d9b310d6f..650ee4f47 100644
--- a/src/cfg/liveness-traversal.h
+++ b/src/cfg/liveness-traversal.h
@@ -152,7 +152,16 @@ struct LivenessWalker : public CFGWalker<SubType, VisitorType, Liveness> {
// if it has side effects)
if (!self->currBasicBlock) {
if (curr->isTee()) {
- *currp = curr->value;
+ // We can remove the tee, but must leave something of the exact same
+ // type.
+ auto originalType = curr->type;
+ if (originalType != curr->value->type) {
+ *currp =
+ Builder(*self->getModule()).makeBlock({curr->value}, originalType);
+ } else {
+ // No special handling, just use the value.
+ *currp = curr->value;
+ }
} else {
*currp = Builder(*self->getModule()).makeDrop(curr->value);
}