[PATCH] D44147: [InstCombine] Fold add/sub over phi node

Hiroshi Inoue via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 7 01:32:52 PST 2018


inouehrs added a comment.

Thanks for the comments!
After disabling optimization for loop induction variables, optimization still happens more than 10k during the bootstrap. However, I cannot see visible change in code size and performance with benchmarks.
So, I will revisit this when I find a realistic case for which it matters.

As a simplified toy example, the following C code results in obviously redundant generated code:

  unsigned long func(unsigned long v, bool b) {
    unsigned long rc;
    if (b) rc = v + 1;
    else rc = callee(v);
    return rc - 1;
  }

generates a code sequence like

  	addi 3, 3, 1
  	addi 3, 3, -1
  	blr




https://reviews.llvm.org/D44147





More information about the llvm-commits mailing list