This repository was archived by the owner on Jan 23, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +30
-19
lines changed
Expand file tree Collapse file tree 2 files changed +30
-19
lines changed Original file line number Diff line number Diff line change @@ -1971,6 +1971,32 @@ class CSE_Heuristic
19711971 return result;
19721972 }
19731973
1974+ // IsCompatibleType() takes two var_types and returns true if they
1975+ // are compatible types for CSE substitution
1976+ //
1977+ bool IsCompatibleType (var_types cseLclVarTyp, var_types expTyp)
1978+ {
1979+ // Exact type match is the expected case
1980+ if (cseLclVarTyp == expTyp)
1981+ {
1982+ return true ;
1983+ }
1984+
1985+ // We also allow TYP_BYREF and TYP_I_IMPL as compatible types
1986+ //
1987+ if ((cseLclVarTyp == TYP_BYREF) && (expTyp == TYP_I_IMPL))
1988+ {
1989+ return true ;
1990+ }
1991+ if ((cseLclVarTyp == TYP_I_IMPL) && (expTyp == TYP_BYREF))
1992+ {
1993+ return true ;
1994+ }
1995+
1996+ // Otherwise we have incompatible types
1997+ return false ;
1998+ }
1999+
19742000 // PerformCSE() takes a successful candidate and performs the appropriate replacements:
19752001 //
19762002 // It will replace all of the CSE defs with assignments to a new "cse0" LclVar
@@ -2105,7 +2131,10 @@ class CSE_Heuristic
21052131
21062132 /* Figure out the actual type of the value */
21072133 var_types expTyp = genActualType (exp->TypeGet ());
2108- noway_assert (expTyp == cseLclVarTyp);
2134+
2135+ // The cseLclVarType must be a compatible with expTyp
2136+ //
2137+ noway_assert (IsCompatibleType (cseLclVarTyp, expTyp));
21092138
21102139 // This will contain the replacement tree for exp
21112140 // It will either be the CSE def or CSE ref
Original file line number Diff line number Diff line change 255255 <ExcludeList Include =" $(XunitTestBinBase)/baseservices/varargs/varargsupport_r/*" >
256256 <Issue >Varargs supported on this platform</Issue >
257257 </ExcludeList >
258- <ExcludeList Include =" $(XunitTestBinBase)/Interop/PInvoke/BestFitMapping/Char/AFT_PFT/AFT_PFT/*" >
259- <Issue >22436</Issue >
260- </ExcludeList >
261- <ExcludeList Include =" $(XunitTestBinBase)/Interop/PInvoke/BestFitMapping/Char/Assembly_False_False/Assembly_False_False/*" >
262- <Issue >22436</Issue >
263- </ExcludeList >
264- <ExcludeList Include =" $(XunitTestBinBase)/Interop/PInvoke/BestFitMapping/LPStr/AFT_PFT/AFT_PFT/*" >
265- <Issue >22436</Issue >
266- </ExcludeList >
267- <ExcludeList Include =" $(XunitTestBinBase)/Interop/PInvoke/BestFitMapping/LPStr/Assembly_False_False/Assembly_False_False/*" >
268- <Issue >22436</Issue >
269- </ExcludeList >
270258 </ItemGroup >
271259
272260 <!-- Windows x86 specific excludes -->
295283 <ExcludeList Include =" $(XunitTestBinBase)/baseservices/varargs/varargsupport_r/*" >
296284 <Issue >Varargs supported on this platform</Issue >
297285 </ExcludeList >
298- <ExcludeList Include =" $(XunitTestBinBase)/Interop/PInvoke/BestFitMapping/Char/AFT_PFT/AFT_PFT/*" >
299- <Issue >22436</Issue >
300- </ExcludeList >
301- <ExcludeList Include =" $(XunitTestBinBase)/Interop/PInvoke/BestFitMapping/LPStr/AFT_PFT/AFT_PFT/*" >
302- <Issue >22436</Issue >
303- </ExcludeList >
304286 </ItemGroup >
305287
306288 <!-- Windows arm32 specific excludes -->
You can’t perform that action at this time.
0 commit comments