Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(692)

Issue 1141213004: Subzero: Fold icmp into br/select lowering. (Closed)

Created:
5 years, 7 months ago by Jim Stichnoth
Modified:
5 years, 7 months ago
CC:
native-client-reviews_googlegroups.com
Base URL:
https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Subzero: Fold icmp into br/select lowering. Originally there was a peephole-style optimization in lowerIcmp() that looks ahead to see if the next instruction is a conditional branch with the right properties, and if so, folds the icmp and br into a single lowering sequence. However, sometimes extra instructions come between the icmp and br instructions, disabling the folding even though it would still be possible. One thought is to do the folding inside lowerBr() instead of lowerIcmp(), by looking backward for a suitable icmp instruction. The problem here is that the icmp lowering code may leave lowered instructions that can't easily be dead-code eliminated, e.g. instructions lacking a dest variable. Instead, before lowering a basic block, we do a prepass on the block to identify folding candidates. For the icmp/br example, the prepass would tentatively delete the icmp instruction and then the br lowering would fold in the icmp. This folding can also be extended to several producers: icmp (i32 operands), icmp (i64 operands), fcmp, trunc .. to i1 and several consumers: br, select, sext, zext This CL starts with 2 combinations: icmp32 paired with br & select. Other combinations will be added in later CLs. BUG= https://code.google.com/p/nativeclient/issues/detail?id=4162 BUG= https://code.google.com/p/nativeclient/issues/detail?id=4095 R=jvoung@chromium.org Committed: https://gerrit.chromium.org/gerrit/gitweb?p=native_client/pnacl-subzero.git;a=commit;h=a59ae6ffa3d06baaedc25883615a8e8bce67e3fe

Patch Set 1 #

Patch Set 2 : Comments and cleanup #

Total comments: 19

Patch Set 3 : Code review changes #

Patch Set 4 : Remove unnecessary break statement #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+610 lines, -115 lines) Patch
M src/IceCfgNode.cpp View 1 chunk +1 line, -0 lines 0 comments Download
M src/IceClFlags.cpp View 1 chunk +1 line, -0 lines 0 comments Download
M src/IceDefs.h View 1 chunk +1 line, -0 lines 0 comments Download
M src/IceInst.h View 2 chunks +4 lines, -1 line 0 comments Download
M src/IceTargetLowering.h View 1 chunk +1 line, -0 lines 0 comments Download
M src/IceTargetLowering.cpp View 1 chunk +78 lines, -75 lines 0 comments Download
M src/IceTargetLoweringX8632.h View 1 2 4 chunks +71 lines, -0 lines 1 comment Download
M src/IceTargetLoweringX8632.cpp View 1 2 3 6 chunks +237 lines, -39 lines 0 comments Download
M tests_lit/llvm2ice_tests/8bit.pnacl.ll View 2 chunks +5 lines, -0 lines 0 comments Download
A tests_lit/llvm2ice_tests/bool-folding.ll View 1 2 1 chunk +206 lines, -0 lines 0 comments Download
M tests_lit/llvm2ice_tests/select-opt.ll View 1 chunk +5 lines, -0 lines 0 comments Download

Messages

Total messages: 6 (1 generated)
Jim Stichnoth
On my Z620, this improves spec2k performance by 2.5% (geomean of min across 3 runs ...
5 years, 7 months ago (2015-05-15 18:36:04 UTC) #2
jvoung (off chromium)
Cool nice gains =) https://codereview.chromium.org/1141213004/diff/20001/src/IceTargetLoweringX8632.cpp File src/IceTargetLoweringX8632.cpp (right): https://codereview.chromium.org/1141213004/diff/20001/src/IceTargetLoweringX8632.cpp#newcode310 src/IceTargetLoweringX8632.cpp:310: // sequence. This generally that ...
5 years, 7 months ago (2015-05-15 21:48:20 UTC) #3
Jim Stichnoth
https://codereview.chromium.org/1141213004/diff/20001/src/IceTargetLoweringX8632.cpp File src/IceTargetLoweringX8632.cpp (right): https://codereview.chromium.org/1141213004/diff/20001/src/IceTargetLoweringX8632.cpp#newcode310 src/IceTargetLoweringX8632.cpp:310: // sequence. This generally that its lowering sequence requires ...
5 years, 7 months ago (2015-05-16 17:32:51 UTC) #4
jvoung (off chromium)
LGTM also https://code.google.com/p/nativeclient/issues/detail?id=4162 ? https://codereview.chromium.org/1141213004/diff/60001/src/IceTargetLoweringX8632.h File src/IceTargetLoweringX8632.h (right): https://codereview.chromium.org/1141213004/diff/60001/src/IceTargetLoweringX8632.h#newcode68 src/IceTargetLoweringX8632.h:68: enum BoolFoldingConsumerKind { CK_None, CK_Br, ...
5 years, 7 months ago (2015-05-17 16:38:16 UTC) #5
Jim Stichnoth
5 years, 7 months ago (2015-05-17 17:11:49 UTC) #6
Message was sent while issue was closed.
Committed patchset #4 (id:60001) manually as
a59ae6ffa3d06baaedc25883615a8e8bce67e3fe (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698