Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[arm] Fix Unnecessary reloads from GOT.
Summary: This fixes PR35221. Use pseudo-instructions to let MachineCSE hoist global address computation. Subscribers: aemerson, javed.absar, kristof.beyls, llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D39871 llvm-svn: 318081
- Loading branch information
Showing
12 changed files
with
78 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
; PR35221. Test that external global address is not reloaded from GOT in each BB. | ||
; RUN: llc < %s -mtriple=armv7-linux-gnueabi -relocation-model=pic | FileCheck %s -check-prefix=LINUX-PIC | ||
|
||
@x = external global i8, align 1 | ||
|
||
define signext i8 @foo() { | ||
entry: | ||
; LINUX-PIC: ldr r[[A:.]], .LCPI0_0 | ||
; LINUX-PIC: ldr r[[B:.]], [pc, r[[A]]] | ||
; LINUX-PIC: ldrb r{{.}}, [r[[B]]] | ||
%0 = load i8, i8* @x | ||
%tobool = icmp eq i8 %0, 0 | ||
br i1 %tobool, label %bb1, label %bb2 | ||
|
||
bb1: | ||
call void @bar() | ||
; No more pc-relative loads! Reuse r[[B]]. | ||
; LINUX-PIC: bl bar | ||
; LINUX-PIC-NOT: ldr{{.*}}[pc, | ||
; LINUX-PIC: ldrsb r{{.}}, [r[[B]]] | ||
%1 = load i8, i8* @x | ||
ret i8 %1 | ||
|
||
bb2: | ||
ret i8 0 | ||
} | ||
|
||
declare void @bar() | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters