[PATCH] D78765: [TRE] Fix bug in handling of switch statements

Layton Kifer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 24 18:26:03 PDT 2020


laytonio added a comment.

> Suppose, instead, the accumulator always starts at zero.

The accumulator has to start with a value that won't effect the computation. Zero works in the case where we are doing addition, but would not work if we were doing multiplication. We could possibly implement a version that looks at the operation and then decides a starting value. Alternatively, and what I am working on is, we could basically inline one iteration though the loop and start the accumulator with the value you get from the first iteration. I have a version of this working, that does transform your original example. I still wanted to keep the current implementation where it applies though, because there is no need to do the inlining if we can already find the value.


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

https://reviews.llvm.org/D78765





More information about the llvm-commits mailing list