diff --git a/include/llvm/CodeGen/FastISel.h b/include/llvm/CodeGen/FastISel.h index 7c576483774..79b1554e22a 100644 --- a/include/llvm/CodeGen/FastISel.h +++ b/include/llvm/CodeGen/FastISel.h @@ -307,8 +307,6 @@ protected: } private: - bool SelectLoad(const User *I); - bool SelectBinaryOp(const User *I, unsigned ISDOpcode); bool SelectFNeg(const User *I); diff --git a/lib/CodeGen/SelectionDAG/FastISel.cpp b/lib/CodeGen/SelectionDAG/FastISel.cpp index bd49c179804..6c13f27199e 100644 --- a/lib/CodeGen/SelectionDAG/FastISel.cpp +++ b/lib/CodeGen/SelectionDAG/FastISel.cpp @@ -781,40 +781,9 @@ FastISel::SelectFNeg(const User *I) { return true; } -bool -FastISel::SelectLoad(const User *I) { - LoadInst *LI = const_cast(cast(I)); - - // For a load from an alloca, make a limited effort to find the value - // already available in a register, avoiding redundant loads. - if (!LI->isVolatile() && isa(LI->getPointerOperand())) { - BasicBlock::iterator ScanFrom = LI; - if (const Value *V = FindAvailableLoadedValue(LI->getPointerOperand(), - LI->getParent(), ScanFrom)) { - if (!V->use_empty() && - (!isa(V) || - cast(V)->getParent() == LI->getParent() || - (isa(V) && - FuncInfo.StaticAllocaMap.count(cast(V)))) && - (!isa(V) || - LI->getParent() == &LI->getParent()->getParent()->getEntryBlock())) { - unsigned ResultReg = getRegForValue(V); - if (ResultReg != 0) { - UpdateValueMap(I, ResultReg); - return true; - } - } - } - } - - return false; -} - bool FastISel::SelectOperator(const User *I, unsigned Opcode) { switch (Opcode) { - case Instruction::Load: - return SelectLoad(I); case Instruction::Add: return SelectBinaryOp(I, ISD::ADD); case Instruction::FAdd: diff --git a/test/CodeGen/X86/fast-isel-loads.ll b/test/CodeGen/X86/fast-isel-loads.ll deleted file mode 100644 index 2fbb46c0b9f..00000000000 --- a/test/CodeGen/X86/fast-isel-loads.ll +++ /dev/null @@ -1,23 +0,0 @@ -; RUN: llc -march=x86-64 -O0 -asm-verbose=false < %s | FileCheck %s - -; Fast-isel shouldn't reload the argument values from the stack. - -; CHECK: foo: -; CHECK-NEXT: movq %rdi, -8(%rsp) -; CHECK-NEXT: movq %rsi, -16(%rsp) -; CHECK-NEXT: movsd 128(%rsi,%rdi,8), %xmm0 -; CHECK-NEXT: ret - -define double @foo(i64 %x, double* %p) nounwind { -entry: - %x.addr = alloca i64, align 8 ; [#uses=2] - %p.addr = alloca double*, align 8 ; [#uses=2] - store i64 %x, i64* %x.addr - store double* %p, double** %p.addr - %tmp = load i64* %x.addr ; [#uses=1] - %tmp1 = load double** %p.addr ; [#uses=1] - %add = add nsw i64 %tmp, 16 ; [#uses=1] - %arrayidx = getelementptr inbounds double* %tmp1, i64 %add ; [#uses=1] - %tmp2 = load double* %arrayidx ; [#uses=1] - ret double %tmp2 -}