SuccessChanges

Summary

  1. X86: Fix use-after-realloc in X86AsmParser::ParseIntelExpression (details)
  2. [FunctionAttrs] Infer willreturn for functions without loops (details)
  3. [ELF] report section sizes when output file too large (details)
Commit f2fd41d7897e1cc8fc6e9fb2ea46e5b6527852e4 by Duncan P. N. Exon Smith
X86: Fix use-after-realloc in X86AsmParser::ParseIntelExpression

`X86AsmParser::ParseIntelExpression` has a while loop. In the body,
calls to MCAsmLexer::UnLex can force a reallocation in the MCAsmLexer's
`CurToken` SmallVector, invalidating saved references to
`MCAsmLexer::getTok()`.

`const MCAsmToken &Tok` is such a saved reference, and this moves it
from outside the while loop to inside the body, fixing a
use-after-realloc.

`Tok` will still be reused across calls to `Lex()`, each of which
effectively destroys and constructs the pointed-to token. I'm a bit
skeptical of this usage pattern, but it seems broadly used in the
X86AsmParser (and others) so I'm leaving it alone (for now).

Somehow this bug was exposed by https://reviews.llvm.org/D94739,
resulting in test failures in dot-operator related tests in
llvm/test/tools/llvm-ml. I suspect the exposure path is related to
optimizer changes from splitting up the grow operation, but I haven't
dug all the way in. Regardless, there are already tests in tree that
cover this; they might fail consistently if we added ASan
instrumentation to SmallVector.

Differential Revision: https://reviews.llvm.org/D95112
The file was modifiedllvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
Commit 65fd034b95d69fa0e634861ee165b502ceb92a12 by nikita.ppv
[FunctionAttrs] Infer willreturn for functions without loops

If a function doesn't contain loops and does not call non-willreturn
functions, then it is willreturn. Loops are detected by checking
for backedges in the function. We don't attempt to handle finite
loops at this point.

Differential Revision: https://reviews.llvm.org/D94633
The file was modifiedllvm/test/Transforms/FunctionAttrs/atomic.ll
The file was modifiedllvm/test/Transforms/FunctionAttrs/nofree.ll
The file was modifiedllvm/lib/Transforms/IPO/FunctionAttrs.cpp
The file was modifiedllvm/test/Transforms/InferFunctionAttrs/norecurse_debug.ll
The file was modifiedllvm/test/CodeGen/AMDGPU/inline-attr.ll
The file was modifiedllvm/test/Transforms/FunctionAttrs/incompatible_fn_attrs.ll
The file was modifiedllvm/test/Transforms/FunctionAttrs/optnone.ll
The file was modifiedllvm/test/Transforms/FunctionAttrs/writeonly.ll
The file was modifiedclang/test/CodeGenOpenCL/convergent.cl
The file was modifiedllvm/test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll
The file was modifiedllvm/test/Transforms/FunctionAttrs/willreturn.ll
Commit 8e0b17931530e84f45586e31b58b031d6d68ee6c by llvm
[ELF] report section sizes when output file too large

Fixes PR48523. When the linker errors with "output file too large",
one question that comes to mind is how the section sizes differ from
what they were previously. Unfortunately, this information is lost
when the linker exits without writing the output file. This change
makes it so that the error message includes the sizes of the largest
sections.

Reviewed By: MaskRay, grimar, jhenderson

Differential Revision: https://reviews.llvm.org/D94560
The file was modifiedlld/test/ELF/linkerscript/output-too-large.s
The file was modifiedlld/ELF/Writer.cpp