[PATCH] D60908: [WebAssembly] FastISel: Don't fallback to SelectionDAG after BuildMI in selectCall
Sam Clegg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 19 11:37:10 PDT 2019
sbc100 created this revision.
Herald added subscribers: llvm-commits, sunfish, aheejin, hiraditya, jgravelle-google, dschuff.
Herald added a project: LLVM.
sbc100 added reviewers: tlively, dschuff.
My understanding is that once BuildMI has been called we can't fallback
to SelectionDAG.
This change moves the fallback for when getRegForValue() fails for
that target of an indirect call. This was failing in -fPIC mode when
the callee is GlobalValue.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D60908
Files:
llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp
Index: llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp
===================================================================
--- llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp
+++ llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp
@@ -851,6 +851,13 @@
Args.push_back(Reg);
}
+ unsigned CalleeReg = 0;
+ if (!IsDirect) {
+ CalleeReg = getRegForValue(Call->getCalledValue());
+ if (!CalleeReg)
+ return false;
+ }
+
auto MIB = BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc, TII.get(Opc));
if (!IsVoid)
@@ -858,12 +865,8 @@
if (IsDirect)
MIB.addGlobalAddress(Func);
- else {
- unsigned Reg = getRegForValue(Call->getCalledValue());
- if (Reg == 0)
- return false;
- MIB.addReg(Reg);
- }
+ else
+ MIB.addReg(CalleeReg);
for (unsigned ArgReg : Args)
MIB.addReg(ArgReg);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60908.195890.patch
Type: text/x-patch
Size: 848 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190419/93e5b740/attachment.bin>
More information about the llvm-commits
mailing list