dotnet/runtime

JIT: Arm `IsContainableImmed` doesnt handle shifts

開放

#125,578 建立於 2026年3月15日

 (2 則留言) (0 個反應) (0 位負責人)C# (5,445 個分叉)batch import
area-CodeGen-coreclrhelp wantedoptimization

倉庫指標

星標
 (17,886 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

GenTree* shiftConst = m_compiler->gtNewIconNode(31, TYP_INT);
GenTree* sar        = m_compiler->gtNewOperNode(GT_RSH, select->TypeGet(), relopOp1, shiftConst);
CheckImmedAndMakeContained(sar, shiftConst); // false

CheckImmedAndMakeContained calls into IsContainableImmed which on arm doesn't handle shifts and returns false so that shiftConst doesn't get contained even though it could.

The weird thing is that the higher level function ContainCheckNode handles it. That's because it doesn't actually call into CheckImmedAndMakeContained. Meanwhile for other nodes like add the higher level function does call into lower level CheckImmedAndMakeContained:

Add: ContainCheckNode -> ContainCheckBinary -> CheckImmedAndMakeContained -> IsContainableImmed -> MakeSrcContained

Rsh: ContainCheckNode -> ContainCheckShiftRotate -> shiftBy->IsCnsIntOrI -> MakeSrcContained

Maybe ContainCheckShiftRotate should call CheckImmedAndMakeContained which should handle shifts?

貢獻者指南