[PATCH] D55264: [Jump Threading] Unfold a select instruction that feeds a switch statement via a phi node

Ehsan Amiri via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 4 04:58:05 PST 2018


amehsan created this revision.
amehsan added reviewers: brzycki, sebpop.
Herald added subscribers: llvm-commits, jfb.

Currently when a select has a constant value in one branch and the select feeds a conditional branch (via a compare/ phi and compare) we unfold the select statement. This results in threading the conditional branch  later on. Similar opportunity exists when a select (with a constant in one branch) feeds a switch (via a phi node). The patch unfolds select under this condition. A testcase is provided.

The patch is tested on two out of tree targets with internal benchmarks and also with testsuite on X86. There are several cases where this code unfolds a select in testsuite (when testing on X86) but none resulted in performance improvement or degradation.


Repository:
  rL LLVM

https://reviews.llvm.org/D55264

Files:
  include/llvm/Transforms/Scalar/JumpThreading.h
  lib/Transforms/Scalar/JumpThreading.cpp
  test/Transforms/JumpThreading/select.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55264.176605.patch
Type: text/x-patch
Size: 7943 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181204/a47885d0/attachment.bin>


More information about the llvm-commits mailing list