If at least one of the range bounds is "pure", order doesn't matter

This commit is contained in:
Dmitry Petrov
2017-07-07 13:07:29 +03:00
parent 22e12dc139
commit ad80c3cd7f
3 changed files with 22 additions and 3 deletions
@@ -52,8 +52,14 @@ class SimpleBoundedValue(
) : this(codegen, rangeCall, lowBound, true, highBound, true)
override fun putHighLow(v: InstructionAdapter, type: Type) {
lowBound.put(type, v)
highBound.put(type, v)
AsmUtil.swap(v, type, type)
if (!lowBound.canHaveSideEffects() || !highBound.canHaveSideEffects()) {
highBound.put(type, v)
lowBound.put(type, v)
}
else {
lowBound.put(type, v)
highBound.put(type, v)
AsmUtil.swap(v, type, type)
}
}
}