Use SUB instead of XOR to clear fat pointer bit (dotnet/coreclr#12658)
authorJan Kotas <jkotas@microsoft.com>
Thu, 6 Jul 2017 18:35:42 +0000 (20:35 +0200)
committerGitHub <noreply@github.com>
Thu, 6 Jul 2017 18:35:42 +0000 (20:35 +0200)
This makes the code generated for fat calli smaller because of the clearing of the fat pointer bit gets fused into address mode.

Commit migrated from https://github.com/dotnet/coreclr/commit/8e3f231e944e4adb7b8e9e8c364e95ae0b8798da

src/coreclr/src/jit/flowgraph.cpp

index 6f50afd..63897f9 100644 (file)
@@ -24947,7 +24947,7 @@ private:
         {
             GenTreePtr fptrAddressCopy = compiler->gtCloneExpr(fptrAddress);
             GenTreePtr fatPointerMask  = new (compiler, GT_CNS_INT) GenTreeIntCon(TYP_I_IMPL, FAT_POINTER_MASK);
-            return compiler->gtNewOperNode(GT_XOR, pointerType, fptrAddressCopy, fatPointerMask);
+            return compiler->gtNewOperNode(GT_SUB, pointerType, fptrAddressCopy, fatPointerMask);
         }
 
         //------------------------------------------------------------------------