Bug 150748

Summary: B3::reduceStrength's DCE should be more agro and less wrong
Product: WebKit Reporter: Filip Pizlo <fpizlo>
Component: JavaScriptCoreAssignee: Filip Pizlo <fpizlo>
Status: RESOLVED FIXED    
Severity: Normal CC: barraclough, benjamin, cmarcelo, commit-queue, ggaren, mark.lam, mhahnenb, msaboff, nrotem, oliver, saam, sam
Priority: P2    
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 150507    
Attachments:
Description Flags
the patch
none
the patch
saam: review+
the patch
fpizlo: review-
work in progress
none
the patch
none
the patch ggaren: review+

Description Filip Pizlo 2015-10-30 19:10:42 PDT
There's just no good reason not to do a more aggressive DCE, where we presume everything dead and fixpoint to find live things.  It's especially easy when we use the graph helpers I extracted into WTF.
Comment 1 Filip Pizlo 2015-10-30 19:16:05 PDT
Created attachment 264460 [details]
the patch
Comment 2 Filip Pizlo 2015-10-30 19:20:41 PDT
Created attachment 264461 [details]
the patch
Comment 3 Saam Barati 2015-10-31 01:45:08 PDT
Comment on attachment 264461 [details]
the patch

View in context: https://bugs.webkit.org/attachment.cgi?id=264461&action=review

r=me
You're right, writing this kind of DCE is super easy with that data structure.

> Source/JavaScriptCore/ChangeLog:3
> +        B3::reduceStrength's DCE should be more agro

When I read agro I can't help but think of "agriculture"

> Source/JavaScriptCore/ChangeLog:7
> +

It's worth adding a description here.
Comment 4 Filip Pizlo 2015-10-31 11:29:34 PDT
Created attachment 264479 [details]
the patch

Revised patch, with bug fix.
Comment 5 Filip Pizlo 2015-10-31 11:39:13 PDT
Comment on attachment 264479 [details]
the patch

Never mind, it's still broken.
Comment 6 Filip Pizlo 2015-10-31 13:24:05 PDT
Created attachment 264487 [details]
work in progress

To really get a feeling for the bug, I had to use my work-in-progress "complex test" that I'm going to use to compare compile times to LLVM.  So, I think this changeset should just include that.
Comment 7 Filip Pizlo 2015-10-31 15:50:52 PDT
Created attachment 264490 [details]
the patch
Comment 8 WebKit Commit Bot 2015-10-31 15:52:48 PDT
Attachment 264490 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/b3/air/AirInstInlines.h:59:  Place brace on its own line for function definitions.  [whitespace/braces] [4]
ERROR: Tools/ReducedFTL/ComplexTest.cpp:29:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Tools/ReducedFTL/ComplexTest.cpp:30:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Tools/ReducedFTL/ComplexTest.cpp:34:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Tools/ReducedFTL/ComplexTest.cpp:35:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Tools/ReducedFTL/ComplexTest.cpp:36:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Tools/ReducedFTL/ComplexTest.cpp:38:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Tools/ReducedFTL/ComplexTest.cpp:43:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Tools/ReducedFTL/ComplexTest.cpp:45:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Tools/ReducedFTL/ComplexTest.cpp:46:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Tools/ReducedFTL/ComplexTest.cpp:48:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Tools/ReducedFTL/ComplexTest.cpp:50:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Tools/ReducedFTL/ComplexTest.cpp:52:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Tools/ReducedFTL/ComplexTest.cpp:63:  bitwise_cast is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Tools/ReducedFTL/ComplexTest.cpp:98:  When wrapping a line, only indent 4 spaces.  [whitespace/indent] [3]
ERROR: Tools/ReducedFTL/ComplexTest.cpp:210:  Should have a space between // and comment  [whitespace/comments] [4]
Total errors found: 16 in 16 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 9 Filip Pizlo 2015-10-31 16:14:42 PDT
*** Bug 150751 has been marked as a duplicate of this bug. ***
Comment 10 Filip Pizlo 2015-10-31 16:30:10 PDT
Created attachment 264491 [details]
the patch
Comment 11 WebKit Commit Bot 2015-10-31 16:32:33 PDT
Attachment 264491 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/b3/air/AirInstInlines.h:59:  Place brace on its own line for function definitions.  [whitespace/braces] [4]
ERROR: Tools/ReducedFTL/ComplexTest.cpp:29:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Tools/ReducedFTL/ComplexTest.cpp:30:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Tools/ReducedFTL/ComplexTest.cpp:34:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Tools/ReducedFTL/ComplexTest.cpp:35:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Tools/ReducedFTL/ComplexTest.cpp:36:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Tools/ReducedFTL/ComplexTest.cpp:38:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Tools/ReducedFTL/ComplexTest.cpp:43:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Tools/ReducedFTL/ComplexTest.cpp:45:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Tools/ReducedFTL/ComplexTest.cpp:46:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Tools/ReducedFTL/ComplexTest.cpp:48:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Tools/ReducedFTL/ComplexTest.cpp:50:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Tools/ReducedFTL/ComplexTest.cpp:52:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Tools/ReducedFTL/ComplexTest.cpp:63:  bitwise_cast is incorrectly named. Don't use underscores in your identifier names.  [readability/naming/underscores] [4]
ERROR: Tools/ReducedFTL/ComplexTest.cpp:98:  When wrapping a line, only indent 4 spaces.  [whitespace/indent] [3]
ERROR: Tools/ReducedFTL/ComplexTest.cpp:210:  Should have a space between // and comment  [whitespace/comments] [4]
Total errors found: 16 in 28 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 12 Geoffrey Garen 2015-11-01 12:57:25 PST
Comment on attachment 264491 [details]
the patch

View in context: https://bugs.webkit.org/attachment.cgi?id=264491&action=review

r=me

> Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h:339
> +            // Can only shift by ecx, so we do some swapping of we see anything else.

of => if

> Source/JavaScriptCore/runtime/Options.h:340
> +    v(bool, measurePhaseTimings, false, nullptr) \

How about "logB3PhaseTimes" or "useB3TimeLogging"?

"Phase" alone doesn't provide context.
Comment 13 Filip Pizlo 2015-11-01 13:20:07 PST
(In reply to comment #12)
> Comment on attachment 264491 [details]
> the patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=264491&action=review
> 
> r=me
> 
> > Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h:339
> > +            // Can only shift by ecx, so we do some swapping of we see anything else.
> 
> of => if

Fixed!

> 
> > Source/JavaScriptCore/runtime/Options.h:340
> > +    v(bool, measurePhaseTimings, false, nullptr) \
> 
> How about "logB3PhaseTimes" or "useB3TimeLogging"?
> 
> "Phase" alone doesn't provide context.

I used logB3PhaseTimes.
Comment 14 Filip Pizlo 2015-11-01 15:38:31 PST
Landed in http://trac.webkit.org/changeset/191865