Bugfix update: 
Switch instruction is fixed and well optimized if you use it with constants.
The code like this:
            
           var case_val = 3;
            switch (case_val)
            {
                case 1:
                    Console.WriteLine(1);
                    break;
                case 2:
                    Console.WriteLine(2);
                    break;
                case 3:
                    Console.WriteLine(3);
                    break;   
            }
Was not optimized correctly to Console.WriteLine(3); (the rest of code should be removed as dead). Right now the generated C++ code is correct and equivalent with the optimum code.
Escape analysis will allocate also arrays on stack (not the array content but the smart-pointer is not allocated at all). In the past was generated bad code for it.
No comments:
Post a Comment