[PATCH] D139530: [WebAssembly] Add ComplexPattern for loads
Luke Lau via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 8 06:01:58 PST 2022
luke marked an inline comment as not done.
luke added inline comments.
================
Comment at: llvm/lib/Target/WebAssembly/WebAssemblyISelDAGToDAG.cpp:360-361
+
+ // Likewise, treat an 'or' node as an 'add' if the or'ed bits are
+ // known to be zero and fold them into the offset too.
+ if (N.getOpcode() == ISD::OR) {
----------------
tlively wrote:
> Do we have tests covering these cases?
I believe so in `test/CodeGen/WebAssembly/offset.ll` with the functions ending in `with_folded_or_offset`
================
Comment at: llvm/lib/Target/WebAssembly/WebAssemblyRegisterInfo.cpp:79
+ auto &OffsetOp = MI.getOperand(OffsetOperandNum);
+ // Don't fold offset in if offset is a global address to be resolved later
+ if (OffsetOp.isImm()) {
----------------
tlively wrote:
> What's the benefit of this extra logic?
Now that (add tga x) is now selected into something like `i32.load offset=tga, x`, the above assertion was being triggered because it assumed that any `offset` operand would always be an immediate, not a target global address. So this just wraps around it.
I'm not 100% sure as to why this is only triggered now with this patch as I'm fairly certain there were loads being selected like `i32.load offset=tga, 0`
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D139530/new/
https://reviews.llvm.org/D139530
More information about the llvm-commits
mailing list