Instruction *emitLoad(IRBuilder &builder, Value *from, bool inhibitThrow) {
  if (auto *var = llvh::dyn_cast<Variable>(from)) {
    if (Variable::declKindNeedsTDZ(var->getDeclKind()) &&
        var->getRelatedVariable()) {
      builder.createThrowIfUndefinedInst(
          builder.createLoadFrameInst(var->getRelatedVariable()));
    }
    return builder.createLoadFrameInst(var);
  } else if (auto *globalProp = llvh::dyn_cast<GlobalObjectProperty>(from)) {
    if (globalProp->isDeclared() || inhibitThrow)
      return builder.createLoadPropertyInst(
          builder.getGlobalObject(), globalProp->getName());
    else
      return builder.createTryLoadGlobalPropertyInst(globalProp);
  } else {
    llvm_unreachable("unvalid value to load from");
  }
}
Instruction *emitLoad(IRBuilder &builder, Value *from, bool inhibitThrow) {
  if (auto *var = llvh::dyn_cast<Variable>(from)) {
    if (Variable::declKindNeedsTDZ(var->getDeclKind()) &&
        var->getRelatedVariable()) {
      builder.createThrowIfUndefinedInst(
          builder.createLoadFrameInst(var->getRelatedVariable()));
    }
    return builder.createLoadFrameInst(var);
  } else if (auto *globalProp = llvh::dyn_cast<GlobalObjectProperty>(from)) {
    if (globalProp->isDeclared() || inhibitThrow)
      return builder.createLoadPropertyInst(
          builder.getGlobalObject(), globalProp->getName());
    else
      return builder.createTryLoadGlobalPropertyInst(globalProp);
  } else {
    llvm_unreachable("unvalid value to load from");
  }
}