Don't generate copy assertions for normalize on load variables
authorMike Danes <onemihaid@hotmail.com>
Sun, 25 Nov 2018 09:22:08 +0000 (11:22 +0200)
committerMike Danes <onemihaid@hotmail.com>
Sun, 25 Nov 2018 09:22:08 +0000 (11:22 +0200)
Commit migrated from https://github.com/dotnet/coreclr/commit/8e6fa5df402299d833f382679ecf31687f7237a2

src/coreclr/src/jit/assertionprop.cpp

index 88e6b00..dffc5b9 100644 (file)
@@ -1182,6 +1182,13 @@ AssertionIndex Compiler::optCreateAssertion(GenTree*         op1,
                         goto DONE_ASSERTION; // Don't make an assertion
                     }
 
+                    // If we're making a copy of a "normalize on load" lclvar then the destination
+                    // has to be "normalize on load" as well, otherwise we risk skipping normalization.
+                    if (lclVar2->lvNormalizeOnLoad() && !lclVar->lvNormalizeOnLoad())
+                    {
+                        goto DONE_ASSERTION; // Don't make an assertion
+                    }
+
                     //  If the local variable has its address exposed then bail
                     if (lclVar2->lvAddrExposed)
                     {