ARM64: Fix Small Operation For optOptimizeBools
authorKyungwoo Lee <kyulee@microsoft.com>
Thu, 23 Jun 2016 22:30:08 +0000 (15:30 -0700)
committerKyungwoo Lee <kyulee@microsoft.com>
Fri, 24 Jun 2016 20:07:06 +0000 (13:07 -0700)
Fixes https://github.com/dotnet/coreclr/issues/5955

When merging two boolean operations (cmp/jmp) in optOptimizeBools, JIT
creates type based on operand type.
There is a case the operand type is bool (1 byte) so JIT creates a tree
that does 1 byte operation which arm64 cannot encode.
The fix is to bail out such case for arm in general.

This passes all 1375 tests in System.Net.Http.Unit.Tests.

Commit migrated from https://github.com/dotnet/coreclr/commit/1ba04a0d6deaae6152c816bbde33430fd73b088a

src/coreclr/src/jit/optimizer.cpp

index 0fef7af..4a0eb6c 100644 (file)
@@ -7962,7 +7962,11 @@ void                Compiler::optOptimizeBools()
                 continue;
             if (genTypeSize(t1->TypeGet()) != genTypeSize(t2->TypeGet()))
                 continue;
-
+#ifdef _TARGET_ARMARCH_
+            // Skip the small operand which we cannot encode.
+            if (varTypeIsSmall(c1->TypeGet()))
+                continue;
+#endif
             /* The second condition must not contain side effects */
 
             if  (c2->gtFlags & GTF_GLOB_EFFECT)