-
Notifications
You must be signed in to change notification settings - Fork 12.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IR] Don't assume all functions are 4 byte aligned
In some cases different alignments for function might be used to save space e.g. thumb mode with -Oz will try to use 2 byte function alignment. Similar patch that fixed this in other areas exists here https://reviews.llvm.org/D46110 This was approved previously https://reviews.llvm.org/D55115 (r348215) but when committed it caused failures on the sanitizer buildbots when building llvm with clang (containing this patch). This is now fixed because I've added a check to see if getting the parent module returns null if it does then set the alignment to 0. Differential Revision: https://reviews.llvm.org/D55115 llvm-svn: 348571
- Loading branch information
Showing
3 changed files
with
32 additions
and
20 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,27 @@ | ||
| ; RUN: opt < %s -constprop -S -o - | FileCheck %s | ||
|
|
||
| ; Function Attrs: minsize norecurse nounwind optsize readnone | ||
| define dso_local void @foo1() #0 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; Function Attrs: minsize norecurse nounwind optsize readnone | ||
| define dso_local void @foo2() align 4 { | ||
| entry: | ||
| ret void | ||
| } | ||
|
|
||
| ; Function Attrs: minsize nounwind optsize | ||
| define dso_local i32 @main() local_unnamed_addr #1 { | ||
| entry: | ||
| ; CHECK: ptrtoint | ||
| %call = tail call i32 bitcast (i32 (...)* @process to i32 (i32)*)(i32 and (i32 ptrtoint (void ()* @foo1 to i32), i32 2)) #3 | ||
| ; CHECK-NEXT: ptrtoint | ||
| %call2 = tail call i32 bitcast (i32 (...)* @process to i32 (i32)*)(i32 and (i32 ptrtoint (void ()* @foo2 to i32), i32 2)) #3 | ||
| ret i32 0 | ||
| } | ||
|
|
||
| ; Function Attrs: minsize optsize | ||
| declare dso_local i32 @process(...) local_unnamed_addr #2 | ||
|
|
16 changes: 0 additions & 16 deletions
16
llvm/test/Assembler/2004-03-07-FunctionAddressAlignment.ll
This file was deleted.
Oops, something went wrong.