teach reassociate to factor x+x+x -> x*3. While I'm at it,
[oota-llvm.git] / lib / VMCore / IntrinsicInst.cpp
index 6bd9431767e08b595e754943f84fcea262bcca54..5e0f42e063bf870be97f675ff04fde1e0d3a17d4 100644 (file)
@@ -29,7 +29,6 @@
 #include "llvm/Constants.h"
 #include "llvm/GlobalVariable.h"
 #include "llvm/Analysis/ValueTracking.h"
-#include "llvm/CodeGen/MachineDebugInfoDesc.h"
 #include "llvm/CodeGen/MachineModuleInfo.h"
 using namespace llvm;
 
@@ -61,18 +60,20 @@ Value *DbgInfoIntrinsic::StripCast(Value *C) {
 
 Value *DbgStopPointInst::getFileName() const {
   // Once the operand indices are verified, update this assert
-  assert(LLVMDebugVersion == (6 << 16) && "Verify operand indices");
-  GlobalVariable *GV = cast<GlobalVariable>(getContext());
-  if (!GV->hasInitializer()) return NULL;
-  ConstantStruct *CS = cast<ConstantStruct>(GV->getInitializer());
-  return CS->getOperand(4);
+  assert(LLVMDebugVersion == (7 << 16) && "Verify operand indices");
+  return getContext()->getOperand(3);
 }
 
 Value *DbgStopPointInst::getDirectory() const {
   // Once the operand indices are verified, update this assert
-  assert(LLVMDebugVersion == (6 << 16) && "Verify operand indices");
-  GlobalVariable *GV = cast<GlobalVariable>(getContext());
-  if (!GV->hasInitializer()) return NULL;
-  ConstantStruct *CS = cast<ConstantStruct>(GV->getInitializer());
-  return CS->getOperand(4);
+  assert(LLVMDebugVersion == (7 << 16) && "Verify operand indices");
+  return getContext()->getOperand(4);
+}
+
+//===----------------------------------------------------------------------===//
+/// DbgValueInst - This represents the llvm.dbg.value instruction.
+///
+
+Value *DbgValueInst::getValue() const {
+  return cast<MDNode>(getOperand(1))->getOperand(0);
 }