aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2008-12-12 08:13:38 +0000
committerDuncan Sands <baldrick@free.fr>2008-12-12 08:13:38 +0000
commit712f7b3f549644190e90210a07988753f53daa0a (patch)
treee33042fe9a7a144f375fd45a6bc3d2b3ebe2957f /lib
parent8c0f244c3ed90a3f702bac09334cac2d3236aecb (diff)
downloadexternal_llvm-712f7b3f549644190e90210a07988753f53daa0a.zip
external_llvm-712f7b3f549644190e90210a07988753f53daa0a.tar.gz
external_llvm-712f7b3f549644190e90210a07988753f53daa0a.tar.bz2
When using a 4 byte jump table on a 64 bit machine,
do an extending load of the 4 bytes rather than a potentially illegal (type) i32 load followed by a sign extend. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60945 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeDAG.cpp14
1 files changed, 3 insertions, 11 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index 2108abf..1ec9bb1 100644
--- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -1951,23 +1951,15 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
unsigned EntrySize = MF.getJumpTableInfo()->getEntrySize();
Index= DAG.getNode(ISD::MUL, PTy, Index, DAG.getConstant(EntrySize, PTy));
SDValue Addr = DAG.getNode(ISD::ADD, PTy, Index, Table);
-
- SDValue LD;
- switch (EntrySize) {
- default: assert(0 && "Size of jump table not supported yet."); break;
- case 4: LD = DAG.getLoad(MVT::i32, Chain, Addr,
- PseudoSourceValue::getJumpTable(), 0); break;
- case 8: LD = DAG.getLoad(MVT::i64, Chain, Addr,
- PseudoSourceValue::getJumpTable(), 0); break;
- }
+ MVT MemVT = MVT::getIntegerVT(EntrySize * 8);
+ SDValue LD = DAG.getExtLoad(ISD::SEXTLOAD, PTy, Chain, Addr,
+ PseudoSourceValue::getJumpTable(), 0, MemVT);
Addr = LD;
if (TLI.getTargetMachine().getRelocationModel() == Reloc::PIC_) {
// For PIC, the sequence is:
// BRIND(load(Jumptable + index) + RelocBase)
// RelocBase can be JumpTable, GOT or some sort of global base.
- if (PTy != MVT::i32)
- Addr = DAG.getNode(ISD::SIGN_EXTEND, PTy, Addr);
Addr = DAG.getNode(ISD::ADD, PTy, Addr,
TLI.getPICJumpTableRelocBase(Table, DAG));
}