Open llvmbot opened 3 years ago
dispatch1 DAG after X86DAGToDAGISel::PreprocessISelDAG craig.topper@gmail.com
dipatch1 and dispatch15 have a different DAG shape after X86DAGToDAGISel::PreprocessISelDAG (see attachments). There's an optimisation to "try moving call address load from outside callseq_start to just before the call to allow it to be folded." It doesn't handle a multi-parameter case for tail calls.
The following patch fixes it for me:
@@ -778,11 +778,20 @@ static bool isCalleeLoad(SDValue Callee, SDValue &Chain, bool HasCallSeq) { LD->getExtensionType() != ISD::NON_EXTLOAD) return false;
assigned to @topperc
Extended Description
The following snippet produces the assembly with function pointer table indexing folded into JMP:
typedef void (FnTy3) (void );
void dispatch15(FnTy3 *tab, intptr_t i) { tabi; }
_dispatch15: ## @dispatch15
%bb.0: ## %entry
If the called function takes at least 2 parameters, indexing isn't folded.
typedef void (FnTy2) (void , intptr_t);
void dispatch1(FnTy2 *tab, intptr_t i) { tab[i](tab, i); }
_dispatch1: ## @dispatch1
%bb.0: ## %entry