[all-commits] [llvm/llvm-project] f98535: [SimplifyCFG] simplifyUnreachable(): switch to non...

Roman Lebedev via All-commits all-commits at lists.llvm.org
Tue Jan 5 14:57:04 PST 2021


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: f98535686e3c1fa76986337639df1636282692c9
      https://github.com/llvm/llvm-project/commit/f98535686e3c1fa76986337639df1636282692c9
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-01-06 (Wed, 06 Jan 2021)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp

  Log Message:
  -----------
  [SimplifyCFG] simplifyUnreachable(): switch to non-permissive DomTree updates

... which requires not removing a DomTree edge if the switch's default
still points at that destination, because it can't be removed;
... and not processing the same predecessor more than once.


  Commit: 3460719f583583e6990ec5c1b2a718cc01797bf7
      https://github.com/llvm/llvm-project/commit/3460719f583583e6990ec5c1b2a718cc01797bf7
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-01-06 (Wed, 06 Jan 2021)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp
    A llvm/test/Transforms/SimplifyCFG/simplifyUnreachable-degenerate-conditional-branch-with-matching-destinations.ll

  Log Message:
  -----------
  [NFC][SimplifyCFG] Add a test with same-destination condidional branch

Reported by Mikael Holmén as post-commit feedback on
https://reviews.llvm.org/rG2d07414ee5f74a09fb89723b4a9bb0818bdc2e18#968162


  Commit: 29ca7d5a1ad968c371124b8d82edd8d91eee7b4f
      https://github.com/llvm/llvm-project/commit/29ca7d5a1ad968c371124b8d82edd8d91eee7b4f
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-01-06 (Wed, 06 Jan 2021)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp
    M llvm/test/Transforms/SimplifyCFG/simplifyUnreachable-degenerate-conditional-branch-with-matching-destinations.ll

  Log Message:
  -----------
  [SimplifyCFG] simplifyUnreachable(): fix handling of degenerate same-destination conditional branch

One would hope that it would have been already canonicalized into an
unconditional branch, but that isn't really guaranteed to happen
with SimplifyCFG's visitation order.


  Commit: fc96cb2dad6b8293124f12d00fb55ff75c2ebe71
      https://github.com/llvm/llvm-project/commit/fc96cb2dad6b8293124f12d00fb55ff75c2ebe71
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-01-06 (Wed, 06 Jan 2021)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp

  Log Message:
  -----------
  [SimplifyCFG] FoldValueComparisonIntoPredecessors(): switch to non-permissive DomTree updates

... which requires not adding a DomTree edge that we just added.


  Commit: d15d81ce15e086208f30d99ce2257a75401dc12c
      https://github.com/llvm/llvm-project/commit/d15d81ce15e086208f30d99ce2257a75401dc12c
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-01-06 (Wed, 06 Jan 2021)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp

  Log Message:
  -----------
  [SimplifyCFG] FoldValueComparisonIntoPredecessors(): deal with each predecessor only once

If the predecessor is a switch, and BB is not the default destination,
multiple cases could have the same destination. and it doesn't
make sense to re-process the predecessor, because we won't make any changes,
once is enough.

I'm not sure this can be really tested, other than via the assertion
being added here, which fires without the fix.


  Commit: fa5447aa3fec313bfd8ec31b7c66d390a5589b94
      https://github.com/llvm/llvm-project/commit/fa5447aa3fec313bfd8ec31b7c66d390a5589b94
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-01-06 (Wed, 06 Jan 2021)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp

  Log Message:
  -----------
  [NFC][SimplifyCFG] SwitchToLookupTable(): pull out SI->getParent() into a variable


  Commit: 2b437fcd479befb96bd61e71c4de8143bd861a48
      https://github.com/llvm/llvm-project/commit/2b437fcd479befb96bd61e71c4de8143bd861a48
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-01-06 (Wed, 06 Jan 2021)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp

  Log Message:
  -----------
  [SimplifyCFG] SwitchToLookupTable(): switch to non-permissive DomTree updates

... which requires not deleting a DomTree edge that we just deleted.


  Commit: 0a87e53fc40ffd644139cdd210e7c382dbe329c8
      https://github.com/llvm/llvm-project/commit/0a87e53fc40ffd644139cdd210e7c382dbe329c8
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-01-06 (Wed, 06 Jan 2021)

  Changed paths:
    A llvm/test/Transforms/SimplifyCFG/SimplifyEqualityComparisonWithOnlyPredecessor-domtree-preservation-edgecase.ll

  Log Message:
  -----------
  [NFC][SimplifyCFG] Add a test where SimplifyEqualityComparisonWithOnlyPredecessor() deletes existing edge


  Commit: a14945c1db614261a6f8d5d199e246d78f51e977
      https://github.com/llvm/llvm-project/commit/a14945c1db614261a6f8d5d199e246d78f51e977
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-01-06 (Wed, 06 Jan 2021)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp
    M llvm/test/Transforms/SimplifyCFG/SimplifyEqualityComparisonWithOnlyPredecessor-domtree-preservation-edgecase.ll

  Log Message:
  -----------
  [SimplifyCFG] SimplifyEqualityComparisonWithOnlyPredecessor(): really don't delete DomTree edges multiple times


Compare: https://github.com/llvm/llvm-project/compare/cb5b52a06eeb...a14945c1db61


More information about the All-commits mailing list