[PATCH] D38236: [PowerPC] eliminate partially redundant compare instruction

Hiroshi Inoue via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 25 06:32:54 PDT 2017


inouehrs created this revision.

This is a follow-on of https://reviews.llvm.org/D37211.

https://reviews.llvm.org/D37211 eliminates a compare instruction if two conditional branches can be made based on the one compare instruction, e.g.

  if (a == 0) { ... }
  else if (a < 0) { ... }

This patch extends this optimization to support partially redundant cases, which often happen in while loops.
For example, one compare instruction is moved from the loop body into the preheader by this optimization in the following example.

  do {
    if (a == 0) dummy1();
    a = func(a);
  } while (a > 0); 


https://reviews.llvm.org/D38236

Files:
  lib/Target/PowerPC/PPCMIPeephole.cpp
  test/CodeGen/PowerPC/cmp_elimination.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38236.116543.patch
Type: text/x-patch
Size: 12886 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170925/a43602e7/attachment.bin>


More information about the llvm-commits mailing list