[all-commits] [llvm/llvm-project] effbbd: [NFC][SimplifyCFG] Add another miscompiled test fo...

Roman Lebedev via All-commits all-commits at lists.llvm.org
Mon Dec 14 09:15:29 PST 2020


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: effbbdec6e954798b8ae6a5f3c5cd45995a0a2eb
      https://github.com/llvm/llvm-project/commit/effbbdec6e954798b8ae6a5f3c5cd45995a0a2eb
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2020-12-14 (Mon, 14 Dec 2020)

  Changed paths:
    M llvm/test/Transforms/SimplifyCFG/fold-branch-to-common-dest.ll

  Log Message:
  -----------
  [NFC][SimplifyCFG] Add another miscompiled test for PR48450


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

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

  Log Message:
  -----------
  [NFC][SimplifyCFG] FoldBranchToCommonDest(): pull out 'common successor' into a variable

Makes it easier to use it elsewhere


  Commit: 59560e85897afc50090b6c3d920bacfd28b49d06
      https://github.com/llvm/llvm-project/commit/59560e85897afc50090b6c3d920bacfd28b49d06
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2020-12-14 (Mon, 14 Dec 2020)

  Changed paths:
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp
    M llvm/test/Transforms/LoopUnroll/peel-loop-inner.ll
    M llvm/test/Transforms/SimplifyCFG/fold-branch-to-common-dest.ll

  Log Message:
  -----------
  [SimplifyCFG] FoldBranchToCommonDest(): temporairly put back restrictions on liveout uses of bonus instructions (PR48450)

Even though d38205144febf4dc42c9270c6aa3d978f1ef65e1 was mostly a correct
fix for the external non-PHI users, it's not a *generally* correct fix,
because the 'placeholder' values in those trivial PHI's we create
shouldn't be *always* 'undef', but the PHI itself for the backedges,
else we end up with wrong value, as the `@pr48450_2` test shows.

But we can't just do that, because we can't check that the PHI
can be it's own incoming value when coming from certain predecessor,
because we don't have a dominator tree.

So until we can address this correctness problem properly,
ensure that we don't perform the transformation
if there are such problematic external uses.

Making dominator tree available there is going to be involved,
since `-simplifycfg` pass currently does not preserve/update domtree...


Compare: https://github.com/llvm/llvm-project/compare/3c8e31e17b85...59560e85897a


More information about the All-commits mailing list