[PATCH] D66329: [PowerPC] [Peephole] fold frame offset by using index form to save add.

Stefan Pintilie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 30 12:38:35 PDT 2019


stefanp added a comment.

I took this patch and applied it to master today and I noticed that one of the LIT tests fails.
The test is:

  test-suite/MultiSource/Benchmarks/tramp3d-v4/

It segfaults with this patch and runs fine with out it.
I took a quick look at it and it seems that in this basic block:

  ; predecessors: %bb.11, %bb.12, %bb.13
    successors: %bb.21(0x80000000); %bb.21(100.00%)
    liveins: $r6, $r7, $r9, $x4, $x5, $x10, $x12, $x30, $r8
    renamable $x3 = ADDI8 $x1, 32
    STW killed renamable $r8, 32, $x1 :: (store 4 into %ir.arrayidx.i.i.i.i.i.i.i.i424, align 8), (store 4 into %ir.129, align 8)
    STW killed renamable $r6, 36, $x1 :: (store 4 into %ir.132)
    STW killed renamable $r7, 44, $x1 :: (store 4 into %ir.134)
    STW killed renamable $r9, 52, $x1 :: (store 4 into %ir.136)
    renamable $x3 = ADD8 killed renamable $x3, killed renamable $x5
    renamable $x5 = nsw ADD8 killed renamable $x10, killed renamable $x12
    renamable $r3 = LWZ 4, killed renamable $x3 :: (load 4 from %ir.137)
    renamable $x5 = nsw SUBF8 renamable $x4, killed renamable $x5
    STW8 killed renamable $x4, 24, renamable $x30 :: (store 4 into %ir.141)
    renamable $r3 = ADD4 killed renamable $r3, killed renamable $r5, implicit $x5
    B %bb.21

We replace

  renamable $x3 = ADDI8 $x1, 32
  renamable $x3 = ADD8 killed renamable $x3, killed renamable $x5
  renamable $r3 = LWZ 4, killed renamable $x3 :: (load 4 from %ir.137)

with:

  renamable $x3 = ADDI8 $x1, 36
  renamable $r3 = LWZX killed $x5, killed $x3 :: (load 4 from %ir.137)

However, it looks like `x5` is redefined before the load so using it in the LWZX is not safe because it is not the same `x5` as before.


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

https://reviews.llvm.org/D66329





More information about the llvm-commits mailing list