[llvm] [WebAssembly][FastISel] Emit signed loads for sext of i8/i16/i32 (PR #182333)

Derek Schuff via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 19 11:22:23 PST 2026


================
@@ -1323,6 +1354,16 @@ bool WebAssemblyFastISel::selectLoad(const Instruction *I) {
 
   addLoadStoreOperands(Addr, MIB, createMachineMemOperandFor(Load));
 
+  if (FoldExt) {
+    unsigned ExtReg = lookUpRegForValue(Ext);
+    if (ExtReg) {
+      if (MachineInstr *ExtMI = MRI.getUniqueVRegDef(ExtReg)) {
+        MRI.replaceRegWith(ExtReg, ResultReg);
+        ExtMI->eraseFromParent();
+      }
+    }
+    updateValueMap(Ext, ResultReg);
----------------
dschuff wrote:

Do we want to return here? I guess it shouldn't matter if we update the valueMap for the Load since it only has one use and we've just handled it. Maybe cleaner to return anyway.

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


More information about the llvm-commits mailing list