[all-commits] [llvm/llvm-project] a7deed: [NFC][Tests][SimplifyCFG] Trim whitespaces at the ...

Roman Lebedev via All-commits all-commits at lists.llvm.org
Tue Dec 15 13:42:38 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: a7deedc414e2abbe4b9557d46e896a5bdba25f2b
      https://github.com/llvm/llvm-project/commit/a7deedc414e2abbe4b9557d46e896a5bdba25f2b
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2020-12-16 (Wed, 16 Dec 2020)

  Changed paths:
    M llvm/test/Transforms/SimplifyCFG/2003-08-17-BranchFold.ll
    M llvm/test/Transforms/SimplifyCFG/2003-08-17-BranchFoldOrdering.ll
    M llvm/test/Transforms/SimplifyCFG/2008-05-16-PHIBlockMerge.ll
    M llvm/test/Transforms/SimplifyCFG/2008-12-06-SingleEntryPhi.ll
    M llvm/test/Transforms/SimplifyCFG/PHINode.ll
    M llvm/test/Transforms/SimplifyCFG/PhiBlockMerge2.ll
    M llvm/test/Transforms/SimplifyCFG/PhiEliminate.ll
    M llvm/test/Transforms/SimplifyCFG/PhiNoEliminate.ll
    M llvm/test/Transforms/SimplifyCFG/X86/empty-cleanuppad.ll
    M llvm/test/Transforms/SimplifyCFG/common-code-hoisting.ll
    M llvm/test/Transforms/SimplifyCFG/invoke_unwind.ll
    M llvm/test/Transforms/SimplifyCFG/nomerge.ll
    M llvm/test/Transforms/SimplifyCFG/preserve-make-implicit-on-switch-to-br.ll
    M llvm/test/Transforms/SimplifyCFG/trapping-load-unreachable.ll
    M llvm/test/Transforms/SimplifyCFG/wineh-unreachable.ll

  Log Message:
  -----------
  [NFC][Tests][SimplifyCFG] Trim whitespaces at the end of lines


  Commit: e1133179587dd895962a2fe4d6eb0cb1e63b5ee2
      https://github.com/llvm/llvm-project/commit/e1133179587dd895962a2fe4d6eb0cb1e63b5ee2
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2020-12-16 (Wed, 16 Dec 2020)

  Changed paths:
    M llvm/include/llvm/Transforms/Utils/Local.h
    M llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp

  Log Message:
  -----------
  [NFCI][SimplifyCFG] Add basic scaffolding for gradually making the pass DomTree-aware

Two observations:
1. Unavailability of DomTree makes it impossible to make
  `FoldBranchToCommonDest()` transform in certain cases,
   where the successor is dominated by predecessor,
   because we then don't have PHI's, and can't recreate them,
   well, without handrolling 'is dominated by' check,
   which doesn't really look like a great solution to me.
2. Avoiding invalidating DomTree in SimplifyCFG will
   decrease the number of `Dominator Tree Construction` by 5
   (from 28 now, i.e. -18%) in `-O3` old-pm pipeline
   (as per `llvm/test/Other/opt-O3-pipeline.ll`)
   This might or might not be beneficial for compile time.

So the plan is to make SimplifyCFG preserve DomTree, and then
eventually make DomTree fully required and preserved by the pass.

Now, SimplifyCFG is ~7KLOC. I don't think it will be nice
to do all this uplifting in a single mega-commit,
nor would it be possible to review it in any meaningful way.

But, i believe, it should be possible to do this in smaller steps,
introducing the new behavior, in an optional way, off-by-default,
opt-in option, and gradually fixing transforms one-by-one
and adding the flag to appropriate test coverage.

Then, eventually, the default should be flipped,
and eventually^2 the flag removed.

And that is what is happening here - when the new off-by-default option
is specified, DomTree is required and is claimed to be preserved,
and SimplifyCFG-internal assertions verify that the DomTree is still OK.


Compare: https://github.com/llvm/llvm-project/compare/9a883bfa11dd...e1133179587d


More information about the All-commits mailing list