forked from llvm-mirror/llvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TargetRegisterInfo, AArch64] Add target hook for isConstantPhysReg().
Summary: The current implementation of isConstantPhysReg() checks for defs of physical registers to determine if they are constant. Some architectures (e.g. AArch64 XZR/WZR) have registers that are constant and may be used as destinations to indicate the generated value is discarded, preventing isConstantPhysReg() from returning true. This change adds a TargetRegisterInfo hook that overrides the no defs check for cases such as this. Reviewers: MatzeB, qcolombet, t.p.northover, jmolloy Subscribers: junbuml, aemerson, mcrosier, rengolin Differential Revision: https://reviews.llvm.org/D24570 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282543 91177308-0d34-0410-b5e6-96231b3b80d8
- Loading branch information
1 parent
8d5df95
commit dcf371d
Showing
5 changed files
with
62 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# RUN: llc -mtriple=aarch64-none-linux-gnu -run-pass machine-sink -o - %s | FileCheck %s | ||
--- | | ||
define void @sinkwzr() { ret void } | ||
... | ||
--- | ||
name: sinkwzr | ||
tracksRegLiveness: true | ||
registers: | ||
- { id: 0, class: gpr32 } | ||
- { id: 1, class: gpr32 } | ||
- { id: 2, class: gpr32sp } | ||
- { id: 3, class: gpr32 } | ||
- { id: 4, class: gpr32 } | ||
body: | | ||
; Check that WZR copy is sunk into the loop preheader. | ||
; CHECK-LABEL: name: sinkwzr | ||
; CHECK-LABEL: bb.0: | ||
; CHECK-NOT: COPY %wzr | ||
bb.0: | ||
successors: %bb.3, %bb.1 | ||
liveins: %w0 | ||
%0 = COPY %w0 | ||
%1 = COPY %wzr | ||
CBZW %0, %bb.3 | ||
; CHECK-LABEL: bb.1: | ||
; CHECK: COPY %wzr | ||
bb.1: | ||
successors: %bb.2 | ||
B %bb.2 | ||
bb.2: | ||
successors: %bb.3, %bb.2 | ||
%2 = PHI %0, %bb.1, %4, %bb.2 | ||
%w0 = COPY %1 | ||
%3 = SUBSWri %2, 1, 0, implicit-def dead %nzcv | ||
%4 = COPY %3 | ||
CBZW %3, %bb.3 | ||
B %bb.2 | ||
bb.3: | ||
RET_ReallyLR | ||
... |