Skip to content

Commit 58907f6

Browse files
committed
Rebase
Created using spr 1.3.6-beta.1
2 parents 3638204 + 6478b25 commit 58907f6

File tree

2 files changed

+12
-15
lines changed

2 files changed

+12
-15
lines changed

llvm/docs/LangRef.rst

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -951,17 +951,13 @@ rules described below. If an explicit minimum alignment is specified, the
951951
function is forced to have at least that much alignment. All alignments
952952
must be a power of 2.
953953

954-
An explicit preferred alignment (``prefalign``) may also be specified
955-
for a function (definitions only, and must be a power of 2). If a
956-
function does not have a preferred alignment attribute, the preferred
957-
alignment is determined in a target-specific way. The final alignment
958-
of the function is determined in the following way: if the function
959-
size is less than the minimum alignment, the function's alignment will
960-
be at least the minimum alignment. Otherwise, if the function size is
961-
between the minimum alignment and the preferred alignment, the function's
962-
alignment will be at least the power of 2 greater than or equal to the
963-
function size. Otherwise, the function's alignment will be at least the
964-
preferred alignment.
954+
An explicit preferred alignment (``prefalign``) may also be specified for
955+
a function (definitions only, and must be a power of 2). If a function
956+
does not have a preferred alignment attribute, the preferred alignment
957+
is determined in a target-specific way. The preferred alignment, if
958+
provided, is treated as a hint; the final alignment of the function will
959+
generally be set to a value somewhere between the minimum alignment and
960+
the preferred alignment.
965961

966962
If the ``unnamed_addr`` attribute is given, the address is known to not
967963
be significant and two identical functions can be merged.

llvm/lib/CodeGen/MachineFunction.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,13 +326,14 @@ bool MachineFunction::shouldSplitStack() const {
326326
}
327327

328328
Align MachineFunction::getPreferredAlignment() const {
329-
Align PrefAlignment = Align(1);
330-
331-
if (!F.hasOptSize())
332-
PrefAlignment = STI.getTargetLowering()->getPrefFunctionAlignment();
329+
Align PrefAlignment;
333330

334331
if (MaybeAlign A = F.getPreferredAlignment())
335332
PrefAlignment = *A;
333+
else if (!F.hasOptSize())
334+
PrefAlignment = STI.getTargetLowering()->getPrefFunctionAlignment();
335+
else
336+
PrefAlignment = Align(1);
336337

337338
return std::max(PrefAlignment, getAlignment());
338339
}

0 commit comments

Comments
 (0)