[PATCH] D78157: [AArch64InstrInfo] Ignore debug insts in areCFlagsAccessedBetweenInstrs [6/10]

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 24 02:06:35 PDT 2020


mstorsjo added a comment.

This caused a misoptimization for me. With https://martin.st/temp/scene_sad-preproc.c as reproducible source for the issue, I have the following case:

  $ clang-good -target aarch64-w64-mingw32 scene_sad-preproc.c -O3 -S -o good
  $ clang-bad -target aarch64-w64-mingw32 scene_sad-preproc.c -O3 -S -o bad
  $ diff -u good bad
  --- good        2020-04-24 11:46:41.372102971 +0300
  +++ bad 2020-04-24 11:46:28.440377143 +0300
  @@ -156,17 +156,16 @@
          ldrb    w14, [x14, #1]
          add     x12, x12, #2            // =2
          subs    w15, w15, w16
  -       sub     w13, w13, w14
  +       subs    w13, w13, w14
          cneg    w14, w15, mi
  -       cmp     w13, #0                 // =0
          cneg    w13, w13, mi

(With two other unrelated benign differences removed from the diff for clarity.)

In this case, the comparison can't be hoisted into `subs` past the `cneg`, as that does use the condition flags.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78157/new/

https://reviews.llvm.org/D78157





More information about the llvm-commits mailing list