[PATCH] D20847: BitCast infinite loop fix

Evgeny Stupachenko via llvm-commits llvm-commits at lists.llvm.org
Tue May 31 20:34:32 PDT 2016


evstupac added a comment.

> Also, I find removing things from the worklist incredibly, deeply suspicious. Otherwise the rest of InstCombine must be careful not to add the item to the list, no?


Here InstCombine creates exactly the thing it is searching for: new BitCast (lines 1876, 1898) and new PHI (line 1861).

> Could you please explain how this ends up looping? Are we recreating the same input over again?


I'll try to narrow my case and add a test case.
Basically what can occur is:

  xB = load (type B);
  xA = load (type A);
  yB = (B)xA;           // A -> B
  zB = PHI[xB, yB];     // PHI
  zA = (A)zB;           // B -> A
  store zA;
  store zB;

The transformation will create (new instruction marked with +):

  xB = load (type B);
  xA = load (type A);
  +yA = (A)xB;             // B -> A
  +zAn = PHI[yA, xA];      // PHI
  +zBn = (B)zAn;           // A -> B
  store zAn;
  store zBn;


Repository:
  rL LLVM

http://reviews.llvm.org/D20847





More information about the llvm-commits mailing list