Fix gtNewStringLiteralNode (#14744)
authorPetr Bred <bredpetr@gmail.com>
Mon, 30 Oct 2017 18:08:34 +0000 (21:08 +0300)
committerJan Kotas <jkotas@microsoft.com>
Mon, 30 Oct 2017 18:08:34 +0000 (11:08 -0700)
- there is IAT_VALUE case from constructStringLiteral(CoreRT)

Signed-off-by: Petr Bred <bredpetr@gmail.com>
src/jit/gentree.cpp

index 65d35d7..c0c67bc 100644 (file)
@@ -6236,6 +6236,12 @@ GenTreePtr Compiler::gtNewStringLiteralNode(InfoAccessType iat, void* pValue)
 
     switch (iat)
     {
+        case IAT_VALUE: // constructStringLiteral in CoreRT case can return IAT_VALUE
+            tree         = gtNewIconEmbHndNode(pValue, nullptr, GTF_ICON_STR_HDL, nullptr);
+            tree->gtType = TYP_REF;
+            tree         = gtNewOperNode(GT_NOP, TYP_REF, tree); // prevents constant folding
+            break;
+
         case IAT_PVALUE: // The value needs to be accessed via an indirection
             // Create an indirection
             tree = gtNewIndOfIconHandleNode(TYP_REF, (size_t)pValue, GTF_ICON_STR_HDL, false);