Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion llvm/test/CodeGen/X86/large-displacements.ll
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
; RUN: not llc < %s -mtriple=i686 -filetype=null 2>&1 | FileCheck %s -check-prefix=ERR-i686
; RUN: not llc < %s -mtriple=i686 --verify-machineinstrs=0 -filetype=null 2>&1 | FileCheck %s -check-prefix=ERR-i686
; RUN: llc < %s -mtriple=x86_64 | FileCheck %s -check-prefix=x86_64

; Regression test for #121932, #113856, #106352, #69365, #25051 which are caused by
; an incorrectly written assertion for 64-bit offsets when compiling for 32-bit X86.

define i32 @main() #0 {
; ERR-i686: error: <unknown>:0:0: 64-bit offset calculated but target is 32-bit
; ERR-i686: warning: <unknown>:0:0: stack frame size (4294967324) exceeds limit (4294967295) in function 'main'
;
; x86_64-LABEL: main:
; x86_64: # %bb.0: # %entry
Expand Down Expand Up @@ -44,6 +45,7 @@ entry:
; Same test as above but for an anonymous function.
define i32 @0() #0 {
; ERR-i686: error: <unknown>:0:0: 64-bit offset calculated but target is 32-bit
; ERR-i686: warning: <unknown>:0:0: stack frame size (4294967324) exceeds limit (4294967295) in function '@0'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this emitting both an error and a warning

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The warning was always there and was probably missed by @wesleywiser? It is coming from llvm/lib/CodeGen/PrologEpilogInserter.cpp:L315

https://godbolt.org/z/G4W48jcb6

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please can you confirm that this works with builds with EXPENSIVE_CHECKS enabled and disabled

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked with a debug build and EXPENSIVE_CHECKS on and it was still failing with a fatal_error in MachineVerifier. I've used --verify-machineinstrs=0 to fix this for now, but probably we need to check the return code in PEIImpl::replaceFrameIndices to stop codegen after the error?

      // If this instruction has a FrameIndex operand, we need to
      // use that target machine register info object to eliminate
      // it.
      TRI.eliminateFrameIndex(MI, SPAdj, i, RS);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry but it looks like we need to revert #123872 and address the problem properly (and when we recommit the tests will need -verify-machineinstr set)

;
; x86_64-LABEL: __unnamed_1:
; x86_64: # %bb.0: # %entry
Expand Down