[PATCH] Implement ADRP CSE for global symbols

Quentin Colombet qcolombet at apple.com
Mon Apr 21 11:45:53 PDT 2014


  Hi Jiangning,

  I copy/paste my comments from the other thread here to ease the tracking.

  I wanted to sort out the redundant ADRP stuff on ARM64 while using the pseudo instructions (for address computations) before doing any measurements.
  It appears that your patch that adds the external support is not playing nicely (I haven’t looked why) with the existing framework.
  I.e.,
  Here is my test case (notice the use of internal for the globals):
  @x = internal global i32 0, align 4
  @y = internal global i32 0, align 4

  define void @f1(i32 %a1, i32 %a2) {
    store i32 %a1, i32* @x, align 4
    store i32 %a2, i32* @y, align 4
    ret void
  }

  Test1, your patch is disabled:
  llc -o - -mtriple=arm64-apple-ios test.ll -global-merge-on-external=false -arm64-collect-loh=false

  _f1:                                    ; @f1
  	.cfi_startproc
  ; BB#0:
  	adrp	x8, __MergedGlobals at PAGE
  	add	x8, x8, __MergedGlobals at PAGEOFF
  	stp	w0, w1, [x8]
  	ret
  	.cfi_endproc

  Test2, your patch is enabled:
  llc -o - -mtriple=arm64-apple-ios test.ll -global-merge-on-external=true -arm64-collect-loh=false

  _f1:                                    ; @f1
  	.cfi_startproc
  ; BB#0:
  	adrp	x8, __MergedGlobals at PAGE
  	adrp	x9, __MergedGlobals at PAGE
  	add	x9, x9, __MergedGlobals at PAGEOFF
  	str	w0, [x8, __MergedGlobals at PAGEOFF]
  	str	w1, [x9, #4]
  	ret
  	.cfi_endproc

  Could you take a look please?

  Thanks,
  -Quentin

http://reviews.llvm.org/D3432






More information about the llvm-commits mailing list