-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JSC] B3::EliminateCommonSubexpression shouldn't remove reads info af…
…ter processing each block https://bugs.webkit.org/show_bug.cgi?id=265426 rdar://118832222 Reviewed by Yusuke Suzuki. Eliminate common subexpressions in B3 is used to remove redundant B3 nodes. Current algorithm removes block reads info after processing each block. This is wrong since some B3 nodes may be deleted erroneously due to the missing reads info from the processed blocks. To fix this issue, we should update block reads info after processing each node. * JSTests/stress/ecs-store-with-loop.js: Added. (foo): (main): * Source/JavaScriptCore/b3/B3EliminateCommonSubexpressions.cpp: * Source/JavaScriptCore/b3/testb3.h: * Source/JavaScriptCore/b3/testb3_3.cpp: (testCSEStoreWithLoop): (addShrTests): Originally-landed-as: 272448.698@safari-7618-branch (e6aa0aa). rdar://128089690 Canonical link: https://commits.webkit.org/278865@main
- Loading branch information
1 parent
03fffab
commit 1abeda3
Showing
4 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//@ runDefault("--jitPolicyScale=0") | ||
let var1 = 0x80000000; | ||
|
||
function foo() { | ||
for (let i = 0; i < 7; i++) { | ||
var1 = var1 << i; | ||
var1 = var1 - 1; | ||
} | ||
var1 >>= 8; | ||
return var1; | ||
} | ||
noInline(foo); | ||
|
||
function main() { | ||
let ret = undefined; | ||
foo(); | ||
let expected = foo(); | ||
for (let i = 0; i < 1e3; i++) { | ||
ret = foo(); | ||
if (expected != ret) | ||
throw new Error(); | ||
} | ||
} | ||
main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters