[PATCH] D79787: [IndVarSimplify][LoopUtils] Avoid TOCTOU/ordering issues (PR45835)

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 20 01:35:06 PDT 2020


lebedev.ri added a comment.

Thank you for taking a look!

In D79787#2045773 <https://reviews.llvm.org/D79787#2045773>, @mkazantsev wrote:

> In general, I'm ok with nits regarding naming.




> However this `FIXME` is concerning. Could you please add a XFAIL test that shows the difference between current state and when this check is turned into assert?

I don't have an actionable example at hand. I could just drop FIXME if it's too weird.

The thought is:
since the current as we have just seen in the new testcase the order of expansion affects the cost calculation,
then

1. may it be the case that we might have two exit values (`A` and `B`) that we can rewrite
2. one is high-cost (`A`) while other one is not high-cost (`B`)
3. the high-cost `A` is based on low-cost `B` (something like `A = B + 42`)

Therefore, if we'd expand low-cost `B` first, then the cost of high-cost `A` would be lower,
potentially becoming low-cost, and we could be okay expanding it too.
Let me know if that does/doesn't make sense.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79787/new/

https://reviews.llvm.org/D79787





More information about the llvm-commits mailing list