[all-commits] [llvm/llvm-project] b9d871: [NFC][SimplifyCFG] Add test for SimplifyCondBranch...

Roman Lebedev via All-commits all-commits at lists.llvm.org
Thu Jul 22 14:37:31 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b9d8719a04350c27eb5542f4da579a8ad62c8c0b
      https://github.com/llvm/llvm-project/commit/b9d8719a04350c27eb5542f4da579a8ad62c8c0b
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-07-23 (Fri, 23 Jul 2021)

  Changed paths:
    M llvm/test/Transforms/SimplifyCFG/return-merge.ll

  Log Message:
  -----------
  [NFC][SimplifyCFG] Add test for SimplifyCondBranchToTwoReturns() mishandling


  Commit: 0d4f2de30317d3726d7d69a7e896b7d600bf5067
      https://github.com/llvm/llvm-project/commit/0d4f2de30317d3726d7d69a7e896b7d600bf5067
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-07-23 (Fri, 23 Jul 2021)

  Changed paths:
    M llvm/test/Transforms/LoopDeletion/simplify-then-delete.ll

  Log Message:
  -----------
  [NFC][LoopDeletion] Autogenerate checlines in simplify-then-delete.ll test


  Commit: d7378259aad35f1092369b45ea7a2e388297293f
      https://github.com/llvm/llvm-project/commit/d7378259aad35f1092369b45ea7a2e388297293f
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-07-23 (Fri, 23 Jul 2021)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp
    M llvm/test/Transforms/LoopDeletion/simplify-then-delete.ll
    M llvm/test/Transforms/PGOProfile/chr.ll
    M llvm/test/Transforms/PhaseOrdering/X86/vector-reductions-logical.ll
    M llvm/test/Transforms/PhaseOrdering/X86/vector-reductions.ll
    M llvm/test/Transforms/SimplifyCFG/PR17073.ll
    M llvm/test/Transforms/SimplifyCFG/X86/SpeculativeExec.ll
    M llvm/test/Transforms/SimplifyCFG/extract-cost.ll
    M llvm/test/Transforms/SimplifyCFG/return-merge.ll

  Log Message:
  -----------
  [SimplifyCFG] SimplifyCondBranchToTwoReturns(): really only deal with different ret blocks

This function is called when some predecessor of an empty return block
ends with a conditional branch, with both successors being empty ret blocks.

Now, because of the way SimplifyCFG works, it might happen to simplify
one of the blocks in a way that makes a conditional branch
into an unconditional one, since it's destinations are now identical,
but it might not have actually simplified said conditional branch
into an unconditional one yet.

So, we have to check that ourselves first,
especially now that SimplifyCFG aggressively tail-merges
all ret and resume blocks.

Even if it was an unconditional branch already,
`SimplifyCFGOpt::simplifyReturn()` doesn't call `FoldReturnIntoUncondBranch()`
by default.


Compare: https://github.com/llvm/llvm-project/compare/f8c6515554cc...d7378259aad3


More information about the All-commits mailing list