// Check if we can optimize this call based on the receiving method and receiver type
// Use the simplified receiver!
IRMethod rm = call.getTargetMethodWithReceiver(r);
if (rm != null) {
IRModule rc = rm.getDefiningIRModule();
if (rc != null) { // TODO: I am fairly sure I am wallpapering
if (rc.isCoreClass("Fixnum")) {
Operand[] args = call.getOperands();
if (args[2].isConstant()) {
addMethodGuard(rm, deoptLabel, versionMap, instrs);
val = ((Fixnum) r).computeValue(rm.getName(), (Constant) args[2]);
}
} else if (rc.isCoreClass("Float")) {
Operand[] args = call.getOperands();
if (args[2].isConstant()) {
addMethodGuard(rm, deoptLabel, versionMap, instrs);
val = ((Float) r).computeValue(rm.getName(), (Constant) args[2]);
}
} else if (rc.isCoreClass("Array")) {
Operand[] args = call.getOperands();
if (args[2] instanceof Fixnum && (rm.getName() == "[]")) {
addMethodGuard(rm, deoptLabel, versionMap, instrs);
val = ((Array) r).fetchCompileTimeArrayElement(((Fixnum) args[2]).value.intValue(), false);
}