[llvm] r305578 - [GVN] Recommit the patch "Add phi-translate support in scalarpre".

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 16 14:08:53 PDT 2017


On Fri, Jun 16, 2017 at 1:21 PM, Wei Mi via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> Author: wmi
> Date: Fri Jun 16 15:21:01 2017
> New Revision: 305578
>
> URL: http://llvm.org/viewvc/llvm-project?rev=305578&view=rev
> Log:
> [GVN] Recommit the patch "Add phi-translate support in scalarpre".
>
> The recommit fixes two bugs: The first one is to use CurrentBlock instead of
> PREInstr's Parent as param of performScalarPREInsertion because the Parent
> of a clone instruction may be uninitialized. The second one is stop PRE when
> CurrentBlock to its predecessor is a backedge and an operand of CurInst is
> defined inside of CurrentBlock. The same value defined inside of loop in last
> iteration can not be regarded as available.
>
> Right now scalarpre doesn't have phi-translate support, so it will miss some
> simple pre opportunities. Like the following testcase, current scalarpre cannot
> recognize the last "a * b" is fully redundent because a and b used by the last
> "a * b" expr are both defined by phis.
>
> long a[100], b[100], g1, g2, g3;
> __attribute__((pure)) long goo();
>
> void foo(long a, long b, long c, long d) {
>
>   g1 = a * b;
>   if (__builtin_expect(g2 > 3, 0)) {
>     a = c;
>     b = d;
>     g2 = a * b;
>   }
>   g3 = a * b;      // fully redundant.
>
> }
> The patch adds phi-translate support in scalarpre. This is only a temporary
> solution before the newpre based on newgvn is available.
>
> Differential Revision: https://reviews.llvm.org/D32252
>

This has unfortunately caused a bunch of failures, I think.
Some of them look very weird as they're in NewGVN (which you didn't touch).

http://lab.llvm.org:8011/builders/clang-x86_64-linux-selfhost-modules-2/builds/8569

--
Davide


More information about the llvm-commits mailing list