[PATCH] D32742: [CodeGen] JumpMaps switch statement optimization (stub)

Marta Wszola via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 2 04:14:50 PDT 2017


MartaW created this revision.
Herald added subscribers: mgorny, MatzeB.

The patch partially implements JumpMaps switch statement optimization (refer to "(RFC) JumpMaps: switch statement optimization" on llvm-dev).
The transformation is not fully implemented yet; the code is required for further discussion.
The JumpMaps emission is turned on with --enable-jump-maps flag (disabled by default).

Current caveats:

1. no support for PIC model
2. search functions are not created / linked automatically, the code generated with optimization needs to be manually linked to __jmfind_x_x functions which (not optimized and generic) implementation can be found in a temporary file jmdev/jmfind.c. The right solution for functions creation / calls / linking are to be discused.
3. the analysis pass should be run on a module, not on a function. it is also not up to date with last changes to SelectionDAGBuilder and TargetLowering.
4. 8 regression tests are failing with JumpMaps enabled (all tests pass if JumpMaps are disabled): LLVM :: CodeGen/Generic/MachineBranchProb.ll LLVM :: CodeGen/X86/branchfolding-catchpads.ll LLVM :: CodeGen/X86/early-ifcvt.ll LLVM :: CodeGen/X86/switch-bt.ll LLVM :: CodeGen/X86/switch-edge-weight.ll LLVM :: CodeGen/X86/switch.ll LLVM :: CodeGen/X86/tail-merge-unreachable.ll LLVM :: CodeGen/X86/x86-shrink-wrapping.ll All the fails are caused by either modifying switch statement lowering (which is expected failure as JumpMaps affect switches handling) or lack of support for PIC model.


https://reviews.llvm.org/D32742

Files:
  include/llvm/CodeGen/AsmPrinter.h
  include/llvm/CodeGen/FunctionLoweringInfo.h
  include/llvm/CodeGen/ISDOpcodes.h
  include/llvm/CodeGen/MachineFunction.h
  include/llvm/CodeGen/MachineInstrBuilder.h
  include/llvm/CodeGen/MachineJumpMapInfo.h
  include/llvm/CodeGen/MachineMemOperand.h
  include/llvm/CodeGen/MachineOperand.h
  include/llvm/CodeGen/Passes.h
  include/llvm/CodeGen/PseudoSourceValue.h
  include/llvm/CodeGen/RuntimeLibcalls.h
  include/llvm/CodeGen/SelectionDAG.h
  include/llvm/CodeGen/SelectionDAGNodes.h
  include/llvm/CodeGen/SwitchAnalysis.h
  include/llvm/InitializePasses.h
  include/llvm/Target/TargetLowering.h
  include/llvm/Target/TargetLoweringObjectFile.h
  include/llvm/Target/TargetSelectionDAG.td
  jmdev/jmfind.c
  lib/CodeGen/AsmPrinter/AsmPrinter.cpp
  lib/CodeGen/BranchFolding.cpp
  lib/CodeGen/CMakeLists.txt
  lib/CodeGen/CodeGen.cpp
  lib/CodeGen/MIRPrinter.cpp
  lib/CodeGen/MachineFunction.cpp
  lib/CodeGen/MachineFunctionPass.cpp
  lib/CodeGen/MachineInstr.cpp
  lib/CodeGen/PseudoSourceValue.cpp
  lib/CodeGen/SelectionDAG/InstrEmitter.cpp
  lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
  lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.h
  lib/CodeGen/SelectionDAG/SelectionDAG.cpp
  lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
  lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
  lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
  lib/CodeGen/SelectionDAG/TargetLowering.cpp
  lib/CodeGen/SwitchAnalysis.cpp
  lib/CodeGen/TargetLoweringBase.cpp
  lib/CodeGen/TargetPassConfig.cpp
  lib/Target/ARM/ARMExpandPseudoInsts.cpp
  lib/Target/TargetLoweringObjectFile.cpp
  lib/Target/X86/X86AsmPrinter.cpp
  lib/Target/X86/X86ISelDAGToDAG.cpp
  lib/Target/X86/X86ISelLowering.cpp
  lib/Target/X86/X86ISelLowering.h
  lib/Target/X86/X86InstrCompiler.td
  lib/Target/X86/X86MCInstLower.cpp
  utils/TableGen/CodeGenDAGPatterns.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32742.97420.patch
Type: text/x-patch
Size: 109812 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170502/73c1898c/attachment-0001.bin>


More information about the llvm-commits mailing list