Fix some bugs, straighten stuff out, more work needs to be done.
[oota-llvm.git] / lib / Transforms / Scalar / DecomposeMultiDimRefs.cpp
index 396b503ebae97231f6514e2c2fd9b7a3e0d9dc32..a97389999e641f0c6efa9e15aa5d7c56300c0615 100644 (file)
@@ -8,7 +8,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Transforms/Scalar/DecomposeMultiDimRefs.h"
+#include "llvm/Transforms/Scalar.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/Constant.h"
 #include "llvm/iMemory.h"
@@ -158,12 +158,9 @@ void DecomposePass::decomposeArrayRef(BasicBlock::iterator &BBI) {
   // Now delete the old instruction...
   delete MAI;
 
-  // Convert our iterator into an index... that cannot get invalidated
-  unsigned ItOffs = BBI-BB->begin();
-
   // Insert all of the new instructions...
-  BB->getInstList().insert(BBI, NewInsts.begin(), NewInsts.end());
+  BBI = BB->getInstList().insert(BBI, NewInsts.begin(), NewInsts.end());
   
   // Advance the iterator to the instruction following the one just inserted...
-  BBI = BB->begin() + ItOffs + NewInsts.size();
+  BBI += NewInsts.size();
 }