Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AsmPrinter] Further restrict expressions supported in global initial…
…izers lowerConstant() currently accepts a number of constant expressions which have corresponding MC expressions, but which cannot be evaluated as a relocatable expression (unless the operands are constant, in which case we'll just fold the expression to a constant). The motivation here is to clarify which constant expressions are really needed for https://discourse.llvm.org/t/rfc-remove-most-constant-expressions/63179, and in particular clarify that we do not need to support any division expressions, which are particularly problematic. Differential Revision: https://reviews.llvm.org/D127972
- Loading branch information
Showing
3 changed files
with
24 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
; RUN: not --crash llc -mtriple=i686-linux-gnu < %s 2>&1 | FileCheck %s | ||
|
||
; Targets only support a limited set of relocations. Make sure that unusual | ||
; constant expressions (and in particular potentially trapping ones involving | ||
; division) are already rejected when lowering the Constant to the MC layer, | ||
; rather than only when trying to emit a relocation. This makes sure that an | ||
; error is reported when targeting assembly (without -filetype=obj). | ||
|
||
@g = external global i32 | ||
@g2 = global i64 sdiv (i64 3, i64 ptrtoint (ptr @g to i64)) | ||
|
||
; CHECK: Unsupported expression in static initializer: sdiv |
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