[PATCH] D41467: PR35710: Nary reassociation falls into infinite loop

Evgeny Stupachenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 21 13:50:54 PST 2017


evstupac added a comment.

To be more precise NaryReassociation works that way:
r0 = v * 16
r1= r0 * 0
r2 = r1 * 1

When reassociating r2 = r1 * 1:
r2 = ((v * 16) * 0) * 1

  RHS = 1
  Aexpr = 0
  Bexpr = 16 * v

We look for findClosestMatchingDominator(0 * 1). It is r1.
That way new Instruction becomes:
r2 = r1 * r0 - which is ok.

Next step for this instruction r2 = r1 * r0:
r2 = ((v * 16) * 0) * (v * 16)

  RHS = 16 *v
  Aexpr = 0
  Bexpr = 16 * v

We look for findClosestMatchingDominator((16 * v) * (16 * v)). It is r1 (because 16 * v * 16 * v = 0 for "i8" type.
That way new Instruction becomes:
r2 = r1 * 0

And it becomes infinite loop...


Repository:
  rL LLVM

https://reviews.llvm.org/D41467





More information about the llvm-commits mailing list