Index: src/types.h |
diff --git a/src/types.h b/src/types.h |
index aafaf07fb5ddc054378ea7a53be68545bb2006ef..f810b3940f0f08400cf2dc4a574aa9342d7b6d2a 100644 |
--- a/src/types.h |
+++ b/src/types.h |
@@ -1035,7 +1035,7 @@ struct BoundsImpl { |
TypeHandle lower = Type::Union(b1.lower, b2.lower, region); |
TypeHandle upper = Type::Intersect(b1.upper, b2.upper, region); |
// Lower bounds are considered approximate, correct as necessary. |
- lower = Type::Intersect(lower, upper, region); |
+ if (!lower->Is(upper)) lower = upper; |
return BoundsImpl(lower, upper); |
} |
@@ -1047,14 +1047,16 @@ struct BoundsImpl { |
} |
static BoundsImpl NarrowLower(BoundsImpl b, TypeHandle t, Region* region) { |
- // Lower bounds are considered approximate, correct as necessary. |
- t = Type::Intersect(t, b.upper, region); |
TypeHandle lower = Type::Union(b.lower, t, region); |
+ // Lower bounds are considered approximate, correct as necessary. |
+ if (!lower->Is(b.upper)) lower = b.upper; |
return BoundsImpl(lower, b.upper); |
} |
static BoundsImpl NarrowUpper(BoundsImpl b, TypeHandle t, Region* region) { |
- TypeHandle lower = Type::Intersect(b.lower, t, region); |
+ TypeHandle lower = b.lower; |
TypeHandle upper = Type::Intersect(b.upper, t, region); |
+ // Lower bounds are considered approximate, correct as necessary. |
+ if (!lower->Is(upper)) lower = upper; |
return BoundsImpl(lower, upper); |
} |