Add kotlin.build.useIR property to compile project with JVM IR

The change in Devirtualization.kt is needed to workaround JVM IR issue
reported at KT-43286.

(cherry picked from commit 4a945686bae98c147a641c0b41d3e8474f133ca2)
This commit is contained in:
Alexander Udalov
2020-11-13 11:19:11 +01:00
committed by Stanislav Erokhin
parent b919685795
commit 10a1ea9091
3 changed files with 13 additions and 1 deletions
@@ -820,7 +820,7 @@ internal object Devirtualization {
val value = fromId.toLong() or (toId.toLong() shl 32)
// This is 64-bit extension of a hashing method from Knuth's "The Art of Computer Programming".
// The magic constant is the closest prime to 2^64 * phi, where phi is the golden ratio.
val bucketIdx = ((value.toULong() * 11400714819323198393UL) % bagOfEdges.size.toUInt()).toInt()
val bucketIdx = ((value.toULong() * 11400714819323198393UL) % bagOfEdges.size.toULong()).toInt()
val bucket = bagOfEdges[bucketIdx] ?: LongArrayList().also { bagOfEdges[bucketIdx] = it }
for (x in bucket)
if (x == value) return