[llvm] [GlobalISel] Use G_ANYEXT instead of G_ZEXT for shift amount widening (PR #223136)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 12 16:07:58 PDT 2026


================
@@ -3096,9 +3097,10 @@ LegalizerHelper::widenScalar(MachineInstr &MI, unsigned TypeIdx, LLT WideTy) {
       widenScalarDst(MI, WideTy);
     } else {
       assert(TypeIdx == 1);
-      // The "number of bits to shift" operand must preserve its value as an
-      // unsigned integer:
-      widenScalarSrc(MI, WideTy, 2, TargetOpcode::G_ZEXT);
+      // The shift amount is undefined behavior for values >= type width,
----------------
arsenm wrote:

It's a poison result, not undefined behavior 

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


More information about the llvm-commits mailing list