summaryrefslogtreecommitdiff
path: root/src/passes/OptimizeInstructions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/passes/OptimizeInstructions.cpp')
-rw-r--r--src/passes/OptimizeInstructions.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/passes/OptimizeInstructions.cpp b/src/passes/OptimizeInstructions.cpp
index 6de1d3d00..edd6ba2b6 100644
--- a/src/passes/OptimizeInstructions.cpp
+++ b/src/passes/OptimizeInstructions.cpp
@@ -751,12 +751,12 @@ struct OptimizeInstructions
// condition, do that
auto needCondition =
EffectAnalyzer(getPassOptions(), iff->condition).hasSideEffects();
- auto typeIsIdentical = iff->ifTrue->type == iff->type;
- if (typeIsIdentical && !needCondition) {
+ auto isSubType = Type::isSubType(iff->ifTrue->type, iff->type);
+ if (isSubType && !needCondition) {
return iff->ifTrue;
} else {
Builder builder(*getModule());
- if (typeIsIdentical) {
+ if (isSubType) {
return builder.makeSequence(builder.makeDrop(iff->condition),
iff->ifTrue);
} else {