[PATCH] D39752: [ARM] Place jump table as the first operand in additions

Momchil Velikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 9 00:40:18 PST 2017


chill added a comment.

In https://reviews.llvm.org/D39752#919736, @efriedma wrote:

> > I prefer to have any kind of IR generated or transformed into some (more or less) canonicalised form, to reduce the number of cases that need to be matched. For such indexed loads it's fairly typical and natural to shift/multiply the index, instead of the base address.
>
> Sure... but we definitely have code in ARMDAGToDAGISel::SelectAddrMode2Worker which tries to commute the base and offset.  I'd like to understand why it isn't triggering.  It's not a big deal to explicitly commute the operands here, but the same issue could affect other cases where the addition comes out of user code.
>
> Just took a quick look with a debugger; it looks like the code never triggers because of the hasOneUse() check?


Yes, that's right. That check was added by the following commit

https://github.com/llvm-mirror/llvm/commit/f40deed62f4f0126459ed7bfd1799f4e09b1aaa7#diff-c3cb15ba0731744ba5fbdc0ba6551c2eL498

I can't quite understand the logic there - certainly it would make more sense to fold the shift into the addressing
mode when shift node *has* one use ?


Repository:
  rL LLVM

https://reviews.llvm.org/D39752





More information about the llvm-commits mailing list