[llvm-commits] CVS: llvm/lib/Transforms/Utils/DemoteRegToStack.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu May 29 10:13:01 PDT 2003


Changes in directory llvm/lib/Transforms/Utils:

DemoteRegToStack.cpp updated: 1.1 -> 1.2

---
Log message:

Eliminate unnecessary ->get calls that are now automatically handled.


---
Diffs of the changes:

Index: llvm/lib/Transforms/Utils/DemoteRegToStack.cpp
diff -u llvm/lib/Transforms/Utils/DemoteRegToStack.cpp:1.1 llvm/lib/Transforms/Utils/DemoteRegToStack.cpp:1.2
--- llvm/lib/Transforms/Utils/DemoteRegToStack.cpp:1.1	Tue Dec 10 07:07:58 2002
+++ llvm/lib/Transforms/Utils/DemoteRegToStack.cpp	Thu May 29 10:12:27 2003
@@ -1,14 +1,14 @@
 //===- DemoteRegToStack.cpp - Move a virtual reg. to stack ------*- C++ -*-===//
 // 
-// This file provide the function DemoteRegToStack().
-// This function takes a virtual register computed by an
-// Instruction& X and replaces it with a slot in the stack frame,
-// allocated via alloca. It returns the pointer to the AllocaInst inserted.
+// This file provide the function DemoteRegToStack().  This function takes a
+// virtual register computed by an Instruction& X and replaces it with a slot in
+// the stack frame, allocated via alloca. It returns the pointer to the
+// AllocaInst inserted.
+//
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Transforms/Utils/DemoteRegToStack.h"
 #include "llvm/Function.h"
-#include "llvm/BasicBlock.h"
 #include "llvm/iMemory.h"
 #include "llvm/iPHINode.h"
 #include "llvm/iTerminators.h"
@@ -16,7 +16,6 @@
 #include "Support/hash_set"
 #include <stack>
 
-
 //---------------------------------------------------------------------------- 
 // function DemoteRegToStack()
 //
@@ -28,11 +27,10 @@
 // Helper function to push a phi *and* all its operands to the worklist!
 // Do not push an instruction if it is already in the result set of Phis to go.
 inline void PushOperandsOnWorkList(std::stack<Instruction*>& workList,
-                                   PhiSet& phisToGo, PHINode* phiN)
-{
-  for (User::op_iterator OI=phiN->op_begin(), OE=phiN->op_end();
+                                   PhiSet& phisToGo, PHINode* phiN) {
+  for (User::op_iterator OI = phiN->op_begin(), OE = phiN->op_end();
        OI != OE; ++OI)
-    if (Instruction* opI = dyn_cast<Instruction>(OI->get()))
+    if (Instruction* opI = dyn_cast<Instruction>(OI))
       if (!isa<PHINode>(opI) ||
           phisToGo.find(cast<PHINode>(opI)) == phisToGo.end())
         workList.push(opI);





More information about the llvm-commits mailing list