[PATCH] D45760: [MIPS] Emit a left-shift instead of a power-of-two multiply for jump-tables

Alexander Richardson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 18 03:24:44 PDT 2018


arichardson created this revision.
arichardson added reviewers: sdardis, atanasyan.
Herald added a subscriber: llvm-commits.

SelectionDAGLegalize::ExpandNode() inserts an ISD::MUL when lowering a
BR_JT opcode. Even though the multiply operand is a constant power of two
the MIPS backend currently always lowers this into a sequence of
load-immediate+multiply+mflo in MipsSETargetLowering::lowerMulDiv().

I am certain this is not the best fix but I'm not sure if it's safe to
just replace the multiply with a shift in LegalizeDAG.


Repository:
  rL LLVM

https://reviews.llvm.org/D45760

Files:
  lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
  lib/Target/Mips/MipsSEISelLowering.cpp
  test/CodeGen/Mips/2010-07-20-Switch.ll
  test/CodeGen/Mips/indirect-jump-hazard/jumptables.ll
  test/CodeGen/Mips/jump-table-mul.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45760.142902.patch
Type: text/x-patch
Size: 5950 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180418/13aac56c/attachment.bin>


More information about the llvm-commits mailing list