[PATCH] D79294: [InstSimplify] Remove known bits constant folding

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 2 15:54:23 PDT 2020


nikic added a comment.

In D79294#2016453 <https://reviews.llvm.org/D79294#2016453>, @xbolva00 wrote:

> >> On test-suite, only lencod.test and GCC-C-execute-pr44858.test show a hash difference after this change.
>
> Did you analyze these changes?


For lencod:

  in function writeMBLayer:
    in block %for.cond138.preheader.i:
      <   %mb_y.0328.i = phi i32 [ 0, %for.cond134.preheader.i ], [ 2, %for.inc219.i ]
    in block %for.inc219.i:
      >   %cmp135.i = icmp eq i64 %indvars.iv383.i, 0
      >   br i1 %cmp135.i, label %for.cond138.preheader.i, label %writeCBPandLumaCoeff.exit
      <   %cmp135.i = icmp eq i32 %mb_y.0328.i, 0
      <   %indvars.iv.next339.i = add nuw nsw i64 %indvars.iv338.i, 2
      <   br i1 %cmp135.i, label %for.cond138.preheader.i, label %writeCBPandLumaCoeff.exit

This is an improvement, we optimize away a loop phi. Don't ask me how.

For the tortune test:

  in function main:
    in block %entry:
      >   %cmp = icmp ne i32 %call, 0
          %0 = load i32, i32* @b, align 4
      >   %cmp1 = icmp ne i32 %0, 1
      >   %or.cond = or i1 %cmp, %cmp1
      >   br i1 %or.cond, label %if.then, label %if.end
      <   %cmp1 = icmp eq i32 %0, 1
      <   br i1 %cmp1, label %if.end, label %if.then

This is a regression, we fail to optimize away a comparison. This test is small enough to trace: We determine that a call always returns zero a bit later, not in time for IPSCCP. As this is noinline-based test case, IPSCCP is the only chance to propagate interprocedurally.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79294/new/

https://reviews.llvm.org/D79294





More information about the llvm-commits mailing list