Fix a FastISel GlobalVariable CSE bug.
authorDan Gohman <gohman@apple.com>
Fri, 19 Sep 2008 23:42:04 +0000 (23:42 +0000)
committerDan Gohman <gohman@apple.com>
Fri, 19 Sep 2008 23:42:04 +0000 (23:42 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56376 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86FastISel.cpp

index 040eb0d4f7796ce21d195e9e037d8fe9fc6bf785..309a3f3f79864498ed0f0093c9dd3c352eb7dbbb 100644 (file)
@@ -379,8 +379,10 @@ bool X86FastISel::X86SelectAddress(Value *V, X86AddressMode &AM, bool isCall) {
     if (Subtarget->GVRequiresExtraLoad(GV, TM, isCall)) {
       // Check to see if we've already materialized this
       // value in a register in this block.
-      if (unsigned Reg = LocalValueMap[V])
-        return Reg;
+      if (unsigned Reg = LocalValueMap[V]) {
+        AM.Base.Reg = Reg;
+        return true;
+      }
       // Issue load from stub if necessary.
       unsigned Opc = 0;
       const TargetRegisterClass *RC = NULL;