PR #11643: Fix unexpected resursive call in ksl for loop
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this [failed invocation](https://github.com/tensorflow/tensorflow/pull/66226/checks?check_run_id=24123724965) of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.
PR #11643: Fix unexpected resursive call in ksl for loop

Imported from GitHub PR https://github.com/openxla/xla/pull/11643

ksl does not have this func: ForWithStatus(string_view, llvm::Value*, llvm::Value*, llvm::Value, bool, const std::function<Status(llvm::Value*, bool)>&), only has ForWithStatus(string_view, llvm::Value*, llvm::Value*, llvm::Value, const std::function<Status(llvm::Value*, bool)>&) which is the expected func call. So if use peel first iteration, will call ForWithStatus(string_view, llvm::Value*, llvm::Value*, llvm::Value, bool, const std::function<Status(llvm::Value*, llvm::Value*)>&) recursively (std::function<Status(llvm::Value*, bool)> will cast to std::function<Status(llvm::Value*, llvm::Value*)> implicitly on my running enviroment), which leads stack smash.
Copybara import of the project:

--
daa71e5687726f30cc8d0da6419e576d4ddedff8 by Zhou, Lingzhi <lingzhi.zhou@intel.com>:

fix unexpected resursive call

--
d67a61ea83d8204c034f6eadb98bebc7fecbcd27 by Zhou, Lingzhi <lingzhi.zhou@intel.com>:

remove deadcode

--
7e1c236da49cf4012cac372db5c7760876563461 by Zhou, Lingzhi <lingzhi.zhou@intel.com>:

fix build error

--
e5ac16d665d88b8b8d1258b1e0e4ebfd94813547 by Zhou, Lingzhi <lingzhi.zhou@intel.com>:

fix filecheck error

Merging this change closes #11643

FUTURE_COPYBARA_INTEGRATE_REVIEW=https://github.com/openxla/xla/pull/11643 from lingzhi98:lingzhi/fix_ksl_for e5ac16d665d88b8b8d1258b1e0e4ebfd94813547
