From 3663f156f705970b566223b4a5966438cd8e3f50 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 25 Sep 2008 01:28:51 +0000 Subject: [PATCH] Fix a recent fast-isel coverage regression - don't bail out before giving the target a chance to materialize constants. llvm-svn: 56605 --- llvm/lib/CodeGen/SelectionDAG/FastISel.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp index 4b773226072c..dd7e95294f11 100644 --- a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp @@ -75,16 +75,17 @@ unsigned FastISel::getRegForValue(Value *V) { } else if (isa(V)) { Reg = createResultReg(TLI.getRegClassFor(VT)); BuildMI(MBB, TII.get(TargetInstrInfo::IMPLICIT_DEF), Reg); - } else { - return 0; } + // If target-independent code couldn't handle the value, give target-specific + // code a try. if (!Reg && isa(V)) Reg = TargetMaterializeConstant(cast(V)); // Don't cache constant materializations in the general ValueMap. // To do so would require tracking what uses they dominate. - LocalValueMap[V] = Reg; + if (Reg != 0) + LocalValueMap[V] = Reg; return Reg; }