Goto.setTarget(g, Goto.getTarget(targetInst));
OPT_BranchOperand top = Goto.getTarget(targetInst); if (top.similar(Goto.getTarget(g))) {      return false; } Goto.setTarget(g, top);
  private boolean processGoto(OPT_IR ir, OPT_Instruction g, 			      OPT_BasicBlock bb) {    OPT_BasicBlock targetBlock = g.getBranchTarget();    OPT_Instruction targetLabel = targetBlock.firstInstruction();    // get the first real instruction at the g target    // NOTE: this instruction is not necessarily in targetBlock,    // iff targetBlock has no real instructions    OPT_Instruction targetInst = firstRealInstructionFollowing(targetLabel);    if (targetInst == null || targetInst == g) {      return false;    }    OPT_Instruction nextLabel = firstLabelFollowing(g);    if (targetLabel == nextLabel) {      // found a GOTO to the next instruction.  just remove it.      g.remove();      return true;    }    if (Goto.conforms(targetInst)) {      // unconditional branch to unconditional branch.      // replace g with goto to targetInst's target      Goto.setTarget(g, Goto.getTarget(targetInst));      bb.recomputeNormalOut(ir); // fix the CFG       return true;    }    if (targetBlock.isEmpty()) {      // GOTO an empty basic block.  Change target to the      // next block.      OPT_BasicBlock nextBlock = targetBlock.getFallThroughBlock();      Goto.setTarget(g, nextBlock.makeJumpTarget());      bb.recomputeNormalOut(ir); // fix the CFG       return true;    }    if (!_restrictCondBranchOpts && IfCmp.conforms(targetInst)) {      // unconditional branch to a conditional branch.      // If the Goto is the only branch instruction in its basic block      // and the IfCmp is the only non-GOTO branch instruction      // in its basic block then replace the goto with a copy of       // targetInst and append another GOTO to the not-taken      // target of targetInst's block.      // We impose these additional restrictions to avoid getting       // multiple conditional branches in a single basic block.      // The LIR does allow this, but some MIR instruction sets don't deal      // with it very well (without multiple condition registers, one is      // forced to either violate the definition of a basic block or break      // the instructions into multiple basic blocks anyways, which requires      // care to avoid separating the actual conditional branch from the      // computation of its input values).       // Also, HIR to LIR translation doesn't handle multiple conditional      // branches in a single basic block correctly either.      if (!g.prevInstructionInCodeOrder().isBranch() && 	  (targetInst.nextInstructionInCodeOrder().operator == BBEND ||	   targetInst.nextInstructionInCodeOrder().operator == GOTO)) {	OPT_Instruction copy = targetInst.copyWithoutLinks();	g.replace(copy);	OPT_Instruction newGoto = 	  getNotTakenNextBlock(targetInst.getBasicBlock()).makeGOTO();	copy.insertAfter(newGoto);	bb.recomputeNormalOut(ir); // fix the CFG 	return true;      }    }    // try to create a fallthrough    if (targetBlock.getNumberOfIn() == 1) {      OPT_BasicBlock ftBlock = targetBlock.getFallThroughBlock();      if (ftBlock != null) {        OPT_BranchOperand ftTarget = ftBlock.makeJumpTarget();        targetBlock.appendInstruction(Goto.create(GOTO,ftTarget));      }           ir.cfg.removeFromCodeOrder(targetBlock);      ir.cfg.insertAfterInCodeOrder(bb,targetBlock);      targetBlock.recomputeNormalOut(ir); // fix the CFG      return true;    }    return false;  }