[PATCH] D20847: BitCast infinite loop fix

Daniel Berlin via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 3 12:38:10 PDT 2016


Yeah, i was about to say, you can make this cycle as large as you want.
It may be that instcombine doesn't happen to match that pattern now, but in
general, it has to have a fixpoint where it says "yeah, this is the right
form" or else you are always prone to infinite loops with phi cycles.


On Fri, Jun 3, 2016 at 12:34 PM, David Majnemer <david.majnemer at gmail.com>
wrote:

> majnemer added inline comments.
>
> ================
> Comment at: lib/Transforms/InstCombine/InstCombineCasts.cpp:1816-1825
> @@ +1815,12 @@
> +  bool Store = false;
> +  for (User *U : PN->users()) {
> +    auto *SI = dyn_cast<StoreInst>(U);
> +    if (SI && SI->isSimple() && SI->getOperand(0) == PN)
> +      Store = true;
> +  }
> +  for (User *U : CI.users()) {
> +    auto *SI = dyn_cast<StoreInst>(U);
> +    if (SI && SI->isSimple() && SI->getOperand(0) == &CI && Store)
> +      return nullptr;
> +  }
> +
> ----------------
> Could a problem arise if this phi was used by a phi?
>
>
> Repository:
>   rL LLVM
>
> http://reviews.llvm.org/D20847
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160603/cae9f8c2/attachment.html>


More information about the llvm-commits mailing list