bool IfConversionPass2::ConvertArrayStoreIf(IfStatement* toConvert)
{
  Statement* thenPart = Denormalize(toConvert->get_then_part()) ;
  Statement* elsePart = Denormalize(toConvert->get_else_part()) ;
  StoreStatement* thenStore = dynamic_cast<StoreStatement*>(thenPart) ;
  StoreStatement* elseStore = dynamic_cast<StoreStatement*>(elsePart) ;
  
  assert(thenStore != NULL) ;
  assert(elseStore != NULL) ;

  ArrayReferenceExpression* thenRef = 
    dynamic_cast<ArrayReferenceExpression*>(thenStore->get_destination_address()) ;
  ArrayReferenceExpression* elseRef = 
    dynamic_cast<ArrayReferenceExpression*>(elseStore->get_destination_address()) ;

  assert(thenRef != NULL) ;
  assert(elseRef != NULL) ;

  // Verify that these array references are to the same location.
  if (!EquivalentExpressions(thenRef, elseRef))
  {
    return false ;
  }

  // This will hopefully be scalar replaced later, but for now we just need
  //  to do something...
  //  What I need is the qualified element type of the array.  
  QualifiedType* qualType = create_qualified_type(theEnv,
						  thenRef->get_result_type()) ;

  StoreStatement* replacement = CreateBoolCall(thenRef) ;

  // Append the arguments to the call expression
  CallExpression* callExpr = 
    dynamic_cast<CallExpression*>(replacement->get_value()) ;
  assert(callExpr != NULL) ;

  Expression* thenStoreValue = thenStore->get_value() ;
  thenStore->set_value(NULL) ;
  callExpr->append_argument(thenStoreValue) ;

  Expression* elseStoreValue = elseStore->get_value() ;
  elseStore->set_value(NULL) ;
  callExpr->append_argument(elseStoreValue) ;

  Expression* condition = toConvert->get_condition() ;
  toConvert->set_condition(NULL) ;
  callExpr->append_argument(condition) ;

  // Replace the if
  toConvert->get_parent()->replace(toConvert, replacement) ;
  return true ;
}