[PATCH] D65148: [SimplifyCFG] Bump phi-node-folding-threshold from 2 to 3

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 13 10:26:41 PDT 2019


dmgreen added a comment.

For that test case above, it was to producing:

  %conv2 = sext i16 %1 to i32
  %add = add nsw i32 %conv2, %conv
  %2 = icmp sgt i32 %add, -32768
  %spec.select.i = select i1 %2, i32 %add, i32 -32768
  %3 = icmp slt i32 %spec.select.i, 32767
  %call7 = select i1 %3, i32 %spec.select.i, i32 32767
  %conv3 = trunc i32 %call7 to i16

And Now:

  %conv2 = sext i16 %1 to i32
  %add = add nsw i32 %conv2, %conv
  %2 = icmp slt i32 %add, 32768
  %3 = icmp sgt i32 %add, -32768
  %4 = select i1 %3, i32 %add, i32 -32768
  %spec.select.i = select i1 %2, i32 %4, i32 32767
  %conv3 = trunc i32 %spec.select.i to i16

Any idea why the `icmp slt i32 %spec.select.i, 32767` is now `icmp slt i32 %add, 32768`? Is that OK?

It looks a lot better than before, but means we need an extra "add 1" to materialise the constants.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65148





More information about the llvm-commits mailing list