liberty/lib/Utilities/AllocaHacks.cpp
// Replace every use of a given oldValue with a newValue
// within the confines of function scope.
Replace every use of a given oldValue with a newValue
within the confines of function scope.
Replace every use of a given oldValue with a newValue within the confines of function scope .
void replaceUsesWithinFcn( Value *oldValue, Function *scope, Value *newValue ) {
    Users userSet;
    for(UI j=oldValue->user_begin(); j!=oldValue->user_end(); ++j) {
      User *user = *j;
      if( Instruction *instr = dyn_cast<Instruction>(user) ) {
        if( instr->getParent()->getParent() == scope ) {
          userSet.push_back(user);
        }
      }
    }
    for (UsersIt j=userSet.begin(), e=userSet.end(); j!=e; ++j)
      (*j)->replaceUsesOfWith( oldValue, newValue );
  }
void replaceUsesWithinFcn ( Value * oldValue , Function * scope , Value * newValue ) { Users userSet ; for ( UI j = oldValue -> user_begin ( ) ; j != oldValue -> user_end ( ) ; ++ j ) { User * user = * j ; if ( Instruction * instr = dyn_cast < Instruction > ( user ) ) { if ( instr -> getParent ( ) -> getParent ( ) == scope ) { userSet . push_back ( user ) ; } } } for ( UsersIt j = userSet . begin ( ) , e = userSet . end ( ) ; j != e ; ++ j ) ( * j ) -> replaceUsesOfWith ( oldValue , newValue ) ; }
Replace every use of a given oldValue with a newValue
within the confines of function scope.
Replace every use of a given oldValue with a newValue within the confines of function scope .
// Collect a set of live-in uses which must be replaced // If this use is an instruction... // ... within this thread, then // privatize it! // replace each use