[PATCH] D31116: arm: don't promote too small constants

James Molloy via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 18 03:00:19 PDT 2017


jmolloy added a comment.

Hi Tim,

I see, thanks. Yes, you're right, the abnormal case of Size == 0 would indeed blow this code up. Can I suggest:

1. You add a "|| Size == 0" term to the if condition on line 3066
2. You add a testcase.

The testcase should be a LIT test. You can see examples in the test/CodeGen/ARM directory which should be where this test should go. Have a look at test/CodeGen/ARM/constantpool-promote.ll - you can tag your test onto the end there.

Something like (appending after the @test9 function):

  @zerosize = private unnamed_addr constant [0 x i16] zeroinitializer, align 4
  ;; Comment for this test
  ; CHECK-LABEL: @pr32130
  ; CHECK: -NOT: adr
  define void @pr32130() #0 {
    tail call void @c(i16* getelementptr inbounds ([0 x i16], [0 x i16]* @zerosize, i32 0, i32 0)) #2
    ret void
  }


https://reviews.llvm.org/D31116





More information about the llvm-commits mailing list