From ea9f151cbc1ce153c7605a02acc31f76cbb3c5a2 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Fri, 18 Jun 2010 20:44:47 +0000 Subject: [PATCH] Fix X86FastISel's address-mode folding to stay within the original basic block. This avoids trouble with examining instructions in other basic blocks which haven't been assigned registers yet. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106310 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86FastISel.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/Target/X86/X86FastISel.cpp b/lib/Target/X86/X86FastISel.cpp index 7bbe6ab5751..cbdfd648429 100644 --- a/lib/Target/X86/X86FastISel.cpp +++ b/lib/Target/X86/X86FastISel.cpp @@ -342,6 +342,12 @@ bool X86FastISel::X86SelectAddress(const Value *V, X86AddressMode &AM) { const User *U = NULL; unsigned Opcode = Instruction::UserOp1; if (const Instruction *I = dyn_cast(V)) { + // Don't walk into other basic blocks; it's possible we haven't + // visited them yet, so the instructions may not yet be assigned + // virtual registers. + if (MBBMap[I->getParent()] != MBB) + return false; + Opcode = I->getOpcode(); U = I; } else if (const ConstantExpr *C = dyn_cast(V)) { -- 2.34.1