forked from rust-lang/llvm
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[LOCAL] Relax unaligned access assertion when type is byte aligned
This commit has been cherry-picked from upstream LLVM review D39946. Once that patch lands in LLVM trunk, we should revert this commit and cherry-pick the official one. Original message: ----------------- This relaxes an assertion inside SelectionDAGBuilder which is overly restrictive on targets which have no concept of alignment (such as AVR). In these architectures, all types are aligned to 8-bits. After this, LLVM will only assert that accesses are aligned on targets which actually require alignment.
- Loading branch information
1 parent
3f259b6
commit 0149e8b
Showing
3 changed files
with
34 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
; RUN: llc -mattr=addsubiw < %s -march=avr | FileCheck %s | ||
|
||
; This verifies that the middle end can handle an unaligned atomic load. | ||
; | ||
; In the past, an assertion inside the SelectionDAGBuilder would always | ||
; hit an assertion for unaligned loads and stores. | ||
|
||
%AtomicI16 = type { %CellI16, [0 x i8] } | ||
%CellI16 = type { i16, [0 x i8] } | ||
|
||
; CHECK-LABEL: foo | ||
; CHECK: ret | ||
define void @foo(%AtomicI16* %self) { | ||
start: | ||
%a = getelementptr inbounds %AtomicI16, %AtomicI16* %self, i16 0, i32 0, i32 0 | ||
load atomic i16, i16* %a seq_cst, align 1 | ||
ret void | ||
} | ||
|