Fix this crasher, and add a FIXME for a missed optimization.
authorOwen Anderson <resistor@mac.com>
Thu, 3 Dec 2009 03:43:29 +0000 (03:43 +0000)
committerOwen Anderson <resistor@mac.com>
Thu, 3 Dec 2009 03:43:29 +0000 (03:43 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90408 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/GVN.cpp
test/Transforms/GVN/crash-2.ll

index ceb57f85a5fae34f396cea3b0aae49de71ee087e..cbe7add582adba6fe578b7f25252451211714bc8 100644 (file)
@@ -1449,6 +1449,16 @@ bool GVN::processNonLocalLoad(LoadInst *LI,
     LoadPtr = MD->GetAvailablePHITranslatedValue(LI->getOperand(0), LoadBB,
                                                  UnavailablePred, TD, *DT);
   }
+
+  // Assign value numbers to these new instructions.
+  for (SmallVector<Instruction*, 8>::iterator NI = NewInsts.begin(),
+       NE = NewInsts.end(); NI != NE; ++NI) {
+    // FIXME: We really _ought_ to insert these value numbers into their 
+    // parent's availability map.  However, in doing so, we risk getting into
+    // ordering issues.  If a block hasn't been processed yet, we would be
+    // marking a value as AVAIL-IN, which isn't what we intend.
+    VN.lookup_or_add(*NI);
+  }
     
   // If we couldn't find or insert a computation of this phi translated value,
   // we fail PRE.
index 8ef66c2baae52a068694c138777b8d46b97e0f4b..2bb5fb02168dd57bf91475220d4a43207dd953b2 100644 (file)
@@ -1,5 +1,4 @@
 ; RUN: opt -gvn -S %s
-; XFAIL: *
 ; rdar://7438974
 
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"