[PATCH] D73943: [WebAssembly] Make stack pointer args inhibit tail calls
Heejin Ahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 13 16:22:08 PST 2020
aheejin accepted this revision.
aheejin added inline comments.
This revision is now accepted and ready to land.
================
Comment at: llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp:738
+ Val = Src;
+ }
+ if (isa<AllocaInst>(Val)) {
----------------
tlively wrote:
> aheejin wrote:
> > I think there can be other cases other than geps and aliases; looking at [[ https://github.com/llvm/llvm-project/blob/0c3b2986ac6b71abc649811c3ec9cb0bf073c7d8/llvm/lib/IR/Value.cpp#L466-L527 | this function ]] might give some ideas. Skimming at the code, it looks [[ https://github.com/llvm/llvm-project/blob/0c3b2986ac6b71abc649811c3ec9cb0bf073c7d8/llvm/lib/IR/Value.cpp#L605-L607 | `stripPointerCastsAndOffsets` ]] does the most comprehensive checking we need.
> `stripPointerCastsAndOffsets` doesn't look through aliases, so it doesn't replace `stripPointerCastsAndAliases`. I could use both in the loop, but I think manually fetching the GEP pointer is clearer. I could probably be convinced otherwise, though.
Ah, you're right that it doesn't look through aliases. But the current implementation here does not look through bitcasts or call return args that `stripPointerCastsAndOffsets`. How about something like this?
```
Value *Val = Arg.get(), *NewVal = nullptr;
while (Val != NewVal) {
NewVal = Val->stripPoinsterCastsAndOffsets()->stripPointerCastsAndAliases();
}
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D73943/new/
https://reviews.llvm.org/D73943
More information about the llvm-commits
mailing list