[all-commits] [llvm/llvm-project] 0fca65: [WebAssembly] Don't fold frame offset for global a...

Heejin Ahn via All-commits all-commits at lists.llvm.org
Tue Nov 3 14:57:13 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 0fca6517118d435f9c2d7afe6135fd5f357509b5
      https://github.com/llvm/llvm-project/commit/0fca6517118d435f9c2d7afe6135fd5f357509b5
  Author: Julien Jorge <jjorge at quarkslab.com>
  Date:   2020-11-03 (Tue, 03 Nov 2020)

  Changed paths:
    M llvm/lib/Target/WebAssembly/WebAssemblyRegisterInfo.cpp
    M llvm/test/CodeGen/WebAssembly/userstack.ll

  Log Message:
  -----------
  [WebAssembly] Don't fold frame offset for global addresses

When machine instructions are in the form of
```
%0 = CONST_I32 @str
%1 = ADD_I32 %stack.0, %0
%2 = LOAD 0, 0, %1
```

In the `ADD_I32` instruction, it is possible to fold it if `%0` is a
`CONST_I32` from an immediate number. But in this case it is a global
address, so we shouldn't do that. But we haven't checked if the operand
of `ADD` is an immediate so far. This fixes the problem. (The case
applies the same for `ADD_I64` and `CONST_I64` instructions.)

Fixes https://bugs.llvm.org/show_bug.cgi?id=47944.

Patch by Julien Jorge (jjorge at quarkslab.com)

Reviewed By: dschuff

Differential Revision: https://reviews.llvm.org/D90577




More information about the All-commits mailing list