[llvm] [WebAssembly] Fix lowering of (extending) loads from addrspace(1) globals (PR #155937)

via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 5 09:33:15 PDT 2025


QuantumSegfault wrote:

> How about making TargetLowering consider the address space value for `setLoadExtAction`, `isLoadExtLegal`, etc? This _feels_ like a sensible option...

Yeah, that'd be perfect! But I was under the impression that making such changes to long standing system to solve a minor issue arising due to an unusual use case would be undesirable.

> Maybe, it might have better handling of address spaces due to its popularity with GPUs. But I'd expect the backend would still have some implementation work to do.

It looks like it natively supports understanding other address spaces (you must define the pointer's address space in the LLT you define as legal for the op), and in general has better support for understanding complex logic without needed custom, optimization breaking code.

Like, address space 0 could be marked "legal" for SEXT/ZEXT, but must be "lowered" for address space 1 (no custom logic required). Then for the LOAD itself: legal for addrspace 0, custom for addrspace 1.

------

Are there any plans to migrate WASM to GlobalISel any time soon? If there's interest but not enough manpower, I wouldn't mind trying to set up the foundation myself (but that will still take up time from reviewers down the line). Or is it simply not worth it at all for this backend?

It seems like the plan is to _eventually_ phase out SelectionDAG and FastISel in favor of it...or am I misunderstanding its purpose?

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


More information about the llvm-commits mailing list