[llvm] [SDAG] fix miss opt: shl nuw + zext adds unnecessary masking (PR #172046)

via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 11 03:53:49 PST 2026


================
@@ -1572,6 +1572,9 @@ SDValue SelectionDAG::getZeroExtendInReg(SDValue Op, const SDLoc &DL, EVT VT) {
   assert(VT.bitsLE(OpVT) && "Not extending!");
   if (OpVT == VT)
     return Op;
+  if (Op.getOpcode() == ISD::AssertZext &&
----------------
actinks wrote:

All the changes are required to achieve the original goal, which is to optimize the test case I added in the pre-commit: llvm/test/CodeGen/X86/pr172046.ll. They are not limited to just the changes introduced by getZeroExtendInReg.

https://github.com/llvm/llvm-project/pull/172046


More information about the llvm-commits mailing list