-
Notifications
You must be signed in to change notification settings - Fork 11k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SelectionDAG] Mark frame index as "aliased" at argument copy elison (#…
…89712) This is a fix for miscompiles reported in #89060 After argument copy elison the IR value for the eliminated alloca is aliasing with the fixed stack object. This patch is making sure that we mark the fixed stack object as being aliased with IR values to avoid that for example schedulers are reordering accesses to the fixed stack object. This could otherwise happen when there is a mix of MemOperands refering the shared fixed stack slow via both the IR value for the elided alloca, and via a fixed stack pseudo source value (as would be the case when lowering the arguments). (cherry picked from commit d8b253b)
- Loading branch information
Showing
3 changed files
with
48 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4 | ||
; RUN: llc -mtriple hexagon-- -o - %s | FileCheck %s | ||
|
||
; Reproducer for https://github.com/llvm/llvm-project/issues/89060 | ||
; | ||
; Problem was a bug in argument copy elison. Given that the %alloca is | ||
; eliminated, the same frame index will be used for accessing %alloca and %a | ||
; on the fixed stack. Care must be taken when setting up | ||
; MachinePointerInfo/MemOperands for those accesses to either make sure that | ||
; we always refer to the fixed stack slot the same way (not using the | ||
; ir.alloca name), or make sure that we still detect that they alias each | ||
; other if using different kinds of MemOperands to identify the same fixed | ||
; stack entry. | ||
; | ||
define i32 @f(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 %q1, i32 %a, i32 %q2) { | ||
; CHECK-LABEL: f: | ||
; CHECK: .cfi_startproc | ||
; CHECK-NEXT: // %bb.0: | ||
; CHECK-NEXT: { | ||
; CHECK-NEXT: r0 = memw(r29+#36) | ||
; CHECK-NEXT: r1 = memw(r29+#28) | ||
; CHECK-NEXT: } | ||
; CHECK-NEXT: { | ||
; CHECK-NEXT: r0 = sub(r1,r0) | ||
; CHECK-NEXT: r2 = memw(r29+#32) | ||
; CHECK-NEXT: memw(r29+#32) = ##666 | ||
; CHECK-NEXT: } | ||
; CHECK-NEXT: { | ||
; CHECK-NEXT: r0 = xor(r0,r2) | ||
; CHECK-NEXT: jumpr r31 | ||
; CHECK-NEXT: } | ||
%alloca = alloca i32 | ||
store i32 %a, ptr %alloca ; Should be elided. | ||
store i32 666, ptr %alloca | ||
%x = sub i32 %q1, %q2 | ||
%y = xor i32 %x, %a ; Results in a load of %a from fixed stack. | ||
; Using same frame index as elided %alloca. | ||
ret i32 %y | ||
} |