Skip to content

[Yul] Add structural simplifier.#5584

Merged
chriseth merged 1 commit intodevelopfrom
structuralSimplifier
Dec 6, 2018
Merged

[Yul] Add structural simplifier.#5584
chriseth merged 1 commit intodevelopfrom
structuralSimplifier

Conversation

@ekpyron
Copy link
Collaborator

@ekpyron ekpyron commented Dec 4, 2018

Closes #5290.

@ekpyron ekpyron self-assigned this Dec 4, 2018
@ekpyron ekpyron force-pushed the structuralSimplifier branch from e42bdd9 to c6894df Compare December 4, 2018 12:08
@codecov
Copy link

codecov bot commented Dec 4, 2018

Codecov Report

Merging #5584 into develop will increase coverage by <.01%.
The diff coverage is 89.87%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #5584      +/-   ##
===========================================
+ Coverage    87.98%   87.99%   +<.01%     
===========================================
  Files          332      334       +2     
  Lines        32108    32183      +75     
  Branches      3855     3863       +8     
===========================================
+ Hits         28250    28319      +69     
- Misses        2551     2554       +3     
- Partials      1307     1310       +3
Flag Coverage Δ
#all 87.99% <89.87%> (ø) ⬆️
#syntax 28.71% <0%> (-0.07%) ⬇️

@stackenbotten

This comment has been minimized.

@ekpyron ekpyron force-pushed the structuralSimplifier branch from 7749ee4 to a5fcffb Compare December 4, 2018 13:36
// ----
// structuralSimplifier
// {
// let a := 42
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check

VarDeclPropagator{}(ast);
RedundantAssignEliminator::run(ast);
UnusedPruner::runUntilStabilised(ast, reservedIdentifiers);
StructuralSimplifier{}(ast);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense to run this before the unused pruner, because it could remove some uses of some variables.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved it to after each run of the expression simplifier now, that's probably a good spot.

@ekpyron
Copy link
Collaborator Author

ekpyron commented Dec 5, 2018

Oh - I hadn't noticed that the appveyor failure is in fact relevant: there are different variable names generated, so may be some nondeterminism

chriseth
chriseth previously approved these changes Dec 5, 2018
@ekpyron ekpyron changed the title [Yul] Add structural simplifier. [DO NOT MERGE YET!] [Yul] Add structural simplifier. Dec 5, 2018
@ekpyron
Copy link
Collaborator Author

ekpyron commented Dec 5, 2018

@chriseth We had an indication of non-determinism in the appveyor test run before (different suffices in some test case) - so we should at least wait for the appveyor test to succeed.

@ekpyron
Copy link
Collaborator Author

ekpyron commented Dec 5, 2018

Still there: for reference:

C:/projects/solidity/test/boostTest.cpp(114): error: in "yulOptimizerTests/fullSuite/medium": Test expectation mismatch.
Expected result:
  fullSuite
  {
      {
          let _1 := 0x20
          let allocate__17 := 0x40
          mstore(allocate__17, add(mload(allocate__17), _1))
          let allocate_p_22_39 := mload(allocate__17)
          mstore(allocate__17, add(allocate_p_22_39, allocate__17))
          mstore(add(allocate_p_22_39, 96), 2)
          mstore(allocate__17, _1)
      }
  }
Obtained result:
  fullSuite
  {
      {
          let _1 := 0x20
          let allocate__19 := 0x40
          mstore(allocate__19, add(mload(allocate__19), _1))
          let allocate_p_24_41 := mload(allocate__19)
          mstore(allocate__19, add(allocate_p_24_41, allocate__19))
          mstore(add(allocate_p_24_41, 96), 2)
          mstore(allocate__19, _1)
      }
  }
***
*** 1 failure is detected in the test module "SolidityTests"

So we have to look into this before merging.

It's a "harmless" difference in a sense, since it's just an alphabetic variant, but still.

// revert(_2, _2)
// }
// let abi_decode_abi_decode_length_14_1069 := 0x2
// if _2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@chriseth
Copy link
Contributor

chriseth commented Dec 5, 2018

That's not funny....
Also I don't see how this PR could have affected it, which is much less funny...

@ekpyron ekpyron dismissed chriseth’s stale review December 5, 2018 18:14

Dismissing to prevent accidental merge before clarifying the non-determinism.

@ekpyron
Copy link
Collaborator Author

ekpyron commented Dec 5, 2018

@chriseth Yes, so far I don't see the cause and it may be unrelated to this PR and just "randomly" triggered here, but "at least" the difference seems to happen deterministically for this PR now.

@ekpyron

This comment has been minimized.

1 similar comment
@ekpyron

This comment has been minimized.

@chriseth chriseth force-pushed the structuralSimplifier branch from a166841 to a5c90af Compare December 6, 2018 16:56
@chriseth
Copy link
Contributor

chriseth commented Dec 6, 2018

Fingers crossed.

Still needs to be squashed.

@ekpyron
Copy link
Collaborator Author

ekpyron commented Dec 6, 2018

Tests just passed. I'm squashing.

@ekpyron ekpyron force-pushed the structuralSimplifier branch from a5c90af to 1eb60cb Compare December 6, 2018 17:37
@ekpyron
Copy link
Collaborator Author

ekpyron commented Dec 6, 2018

Squashed.

@chriseth chriseth changed the title [DO NOT MERGE YET!] [Yul] Add structural simplifier. [Yul] Add structural simplifier. Dec 6, 2018
@chriseth chriseth merged commit ac9f39c into develop Dec 6, 2018
@ekpyron ekpyron deleted the structuralSimplifier branch December 6, 2018 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants