JIT: update switch flags after peel (#53570)
authorAndy Ayers <andya@microsoft.com>
Wed, 2 Jun 2021 16:38:53 +0000 (09:38 -0700)
committerGitHub <noreply@github.com>
Wed, 2 Jun 2021 16:38:53 +0000 (09:38 -0700)
If we introduce a temp for the switch operand, the switch node may have extra flags
set that it doesn't need. Reset these based on the operand.

Closes #53548.

src/coreclr/jit/fgopt.cpp

index 985b7e8..5f029de 100644 (file)
@@ -3799,6 +3799,7 @@ bool Compiler::fgOptimizeSwitchJumps()
 
         // Update flags
         //
+        switchTree->gtFlags = switchTree->AsOp()->gtOp1->gtFlags;
         dominantCaseCompare->gtFlags |= dominantCaseCompare->AsOp()->gtOp1->gtFlags;
         jmpTree->gtFlags |= dominantCaseCompare->gtFlags;
         dominantCaseCompare->gtFlags |= GTF_RELOP_JMP_USED | GTF_DONT_CSE;