SuccessChanges

Summary

  1. [SafeStack] Insert the deref after the offset While debugging code that uses SafeStack, we've noticed that LLVM produces an invalid DWARF. Concretely, in the following example: int main(int argc, char* argv[]) { std::string value = ""; printf("%s\n", value.c_str()); return 0; } DWARF would describe the value variable as being located at: DW_OP_breg14 R14+0, DW_OP_deref, DW_OP_constu 0x20, DW_OP_minus The assembly to get this variable is: leaq -32(%r14), %rbx The order of operations in the DWARF symbols is incorrect in this case. Specifically, the deref is incorrect; this appears to be incorrectly re-inserted in repalceOneDbgValueForAlloca. With this change which inserts the deref after the offset instead of before it, LLVM produces correct DWARF: DW_OP_breg14 R14-32 Differential Revision: https://reviews.llvm.org/D64971
  2. WholeProgramDevirt: Teach the pass to respect the global's alignment. The bytes inserted before an overaligned global need to be padded according to the alignment set on the original global in order for the initializer to meet the global's alignment requirements. The previous implementation that padded to the pointer width happened to be correct for vtables on most platforms but may do the wrong thing if the vtable has a larger alignment. This issue is visible with a prototype implementation of HWASAN for globals, which will overalign all globals including vtables to 16 bytes. There is also no padding requirement for the bytes inserted after the global because they are never read from nor are they significant for alignment purposes, so stop inserting padding there. Differential Revision: https://reviews.llvm.org/D65031
  3. [PowerPC] Fix comment on MO_PLT Target Operand Flag. [NFC] Patch by Xiangling Liao.
  4. [Object][XCOFF] Remove extra includes from XCOFF related files. [NFC] Differential Revision: https://reviews.llvm.org/D60885
  5. LowerTypeTests: Teach the pass to respect global alignments. We were previously ignoring alignment entirely when combining globals together in this pass. There are two main things that we need to do here: add additional padding before each global to meet the alignment requirements, and set the combined global's alignment to the maximum of all of the original globals' alignments. Since we now need to calculate layout as we go anyway, use the calculated layout to produce GlobalLayout instead of using StructLayout. Differential Revision: https://reviews.llvm.org/D65033
  6. Changes to emit CodeView debug info nested type records properly using MCStreamer directives
  7. Adds support for formatting NS_CLOSED_ENUM and CF_CLOSED_ENUM alongside NS_ENUM and CF_ENUM. Summary: Addresses the formatting of NS_CLOSED_ENUM and CF_CLOSED_ENUM, introduced in Swift 5. Before: ``` typedef NS_CLOSED_ENUM(NSInteger, Foo){FooValueOne = 1, FooValueTwo, FooValueThree}; ``` After: ``` typedef NS_CLOSED_ENUM(NSInteger, Foo) { FooValueOne = 1, FooValueTwo, FooValueThree }; ``` Contributed by heijink. Reviewers: benhamilton, krasimir Reviewed By: benhamilton Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65012
  8. [AMDGPU] Test update. NFC.
  9. [SLPVectorizer] Fix some MSVC/cppcheck uninitialized variable warnings. NFCI.
  10. Revert "Reland [ELF] Loose a condition for relocation with a symbol" This reverts commit r366686 as it appears to be causing buildbot failures on sanitizer-x86_64-linux-android and sanitizer-x86_64-linux.
Revision 366726 by phosek:
[SafeStack] Insert the deref after the offset

While debugging code that uses SafeStack, we've noticed that LLVM
produces an invalid DWARF. Concretely, in the following example:

  int main(int argc, char* argv[]) {
    std::string value = "";
    printf("%s\n", value.c_str());
    return 0;
  }

DWARF would describe the value variable as being located at:

  DW_OP_breg14 R14+0, DW_OP_deref, DW_OP_constu 0x20, DW_OP_minus

The assembly to get this variable is:

  leaq    -32(%r14), %rbx

The order of operations in the DWARF symbols is incorrect in this case.
Specifically, the deref is incorrect; this appears to be incorrectly
re-inserted in repalceOneDbgValueForAlloca.

With this change which inserts the deref after the offset instead of
before it, LLVM produces correct DWARF:

  DW_OP_breg14 R14-32

Differential Revision: https://reviews.llvm.org/D64971
Change TypePath in RepositoryPath in Workspace
The file was modified/llvm/trunk/lib/Transforms/Utils/Local.cpp (diff)llvm.src/lib/Transforms/Utils/Local.cpp
The file was modified/llvm/trunk/test/Transforms/SafeStack/X86/debug-loc2.ll (diff)llvm.src/test/Transforms/SafeStack/X86/debug-loc2.ll
Revision 366725 by pcc:
WholeProgramDevirt: Teach the pass to respect the global's alignment.

The bytes inserted before an overaligned global need to be padded according
to the alignment set on the original global in order for the initializer
to meet the global's alignment requirements. The previous implementation
that padded to the pointer width happened to be correct for vtables on most
platforms but may do the wrong thing if the vtable has a larger alignment.

This issue is visible with a prototype implementation of HWASAN for globals,
which will overalign all globals including vtables to 16 bytes.

There is also no padding requirement for the bytes inserted after the global
because they are never read from nor are they significant for alignment
purposes, so stop inserting padding there.

Differential Revision: https://reviews.llvm.org/D65031
Change TypePath in RepositoryPath in Workspace
The file was modified/llvm/trunk/lib/Transforms/IPO/WholeProgramDevirt.cpp (diff)llvm.src/lib/Transforms/IPO/WholeProgramDevirt.cpp
The file was modified/llvm/trunk/test/Transforms/WholeProgramDevirt/virtual-const-prop-begin.ll (diff)llvm.src/test/Transforms/WholeProgramDevirt/virtual-const-prop-begin.ll
The file was modified/llvm/trunk/test/Transforms/WholeProgramDevirt/virtual-const-prop-end.ll (diff)llvm.src/test/Transforms/WholeProgramDevirt/virtual-const-prop-end.ll
Revision 366724 by sfertile:
[PowerPC] Fix comment on MO_PLT Target Operand Flag. [NFC]

Patch by Xiangling Liao.
Change TypePath in RepositoryPath in Workspace
The file was modified/llvm/trunk/lib/Target/PowerPC/PPC.h (diff)llvm.src/lib/Target/PowerPC/PPC.h
Revision 366723 by sfertile:
[Object][XCOFF] Remove extra includes from XCOFF related files. [NFC]

Differential Revision: https://reviews.llvm.org/D60885
Change TypePath in RepositoryPath in Workspace
The file was modified/llvm/trunk/include/llvm/Object/XCOFFObjectFile.h (diff)llvm.src/include/llvm/Object/XCOFFObjectFile.h
The file was modified/llvm/trunk/lib/Object/XCOFFObjectFile.cpp (diff)llvm.src/lib/Object/XCOFFObjectFile.cpp
Revision 366722 by pcc:
LowerTypeTests: Teach the pass to respect global alignments.

We were previously ignoring alignment entirely when combining globals
together in this pass. There are two main things that we need to do here:
add additional padding before each global to meet the alignment requirements,
and set the combined global's alignment to the maximum of all of the original
globals' alignments.

Since we now need to calculate layout as we go anyway, use the calculated
layout to produce GlobalLayout instead of using StructLayout.

Differential Revision: https://reviews.llvm.org/D65033
Change TypePath in RepositoryPath in Workspace
The file was modified/llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp (diff)llvm.src/lib/Transforms/IPO/LowerTypeTests.cpp
The file was added/llvm/trunk/test/Transforms/LowerTypeTests/align.llllvm.src/test/Transforms/LowerTypeTests/align.ll
Revision 366720 by nilanjana_basu:
Changes to emit CodeView debug info nested type records properly using MCStreamer directives
Change TypePath in RepositoryPath in Workspace
The file was modified/llvm/trunk/include/llvm/DebugInfo/CodeView/CodeViewRecordIO.h (diff)llvm.src/include/llvm/DebugInfo/CodeView/CodeViewRecordIO.h
The file was modified/llvm/trunk/include/llvm/DebugInfo/CodeView/TypeRecordMapping.h (diff)llvm.src/include/llvm/DebugInfo/CodeView/TypeRecordMapping.h
The file was modified/llvm/trunk/include/llvm/MC/MCExpr.h (diff)llvm.src/include/llvm/MC/MCExpr.h
The file was modified/llvm/trunk/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp (diff)llvm.src/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp
The file was modified/llvm/trunk/lib/DebugInfo/CodeView/TypeRecordMapping.cpp (diff)llvm.src/lib/DebugInfo/CodeView/TypeRecordMapping.cpp
The file was modified/llvm/trunk/test/DebugInfo/COFF/types-basic.ll (diff)llvm.src/test/DebugInfo/COFF/types-basic.ll
The file was modified/llvm/trunk/test/DebugInfo/COFF/types-data-members.ll (diff)llvm.src/test/DebugInfo/COFF/types-data-members.ll
Revision 366719 by benhamilton:
Adds support for formatting NS_CLOSED_ENUM and CF_CLOSED_ENUM alongside NS_ENUM and CF_ENUM.

Summary:
Addresses the formatting of NS_CLOSED_ENUM and CF_CLOSED_ENUM, introduced in Swift 5.

Before:

```
typedef NS_CLOSED_ENUM(NSInteger, Foo){FooValueOne = 1, FooValueTwo,
                                       FooValueThree};
```

After:

```
typedef NS_CLOSED_ENUM(NSInteger, Foo) {
  FooValueOne = 1,
  FooValueTwo,
  FooValueThree
};
```

Contributed by heijink.

Reviewers: benhamilton, krasimir

Reviewed By: benhamilton

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D65012
Change TypePath in RepositoryPath in Workspace
The file was modified/cfe/trunk/lib/Format/Format.cpp (diff)clang.src/lib/Format/Format.cpp
The file was modified/cfe/trunk/lib/Format/FormatToken.h (diff)clang.src/lib/Format/FormatToken.h
The file was modified/cfe/trunk/lib/Format/UnwrappedLineParser.cpp (diff)clang.src/lib/Format/UnwrappedLineParser.cpp
The file was modified/cfe/trunk/unittests/Format/FormatTest.cpp (diff)clang.src/unittests/Format/FormatTest.cpp
The file was modified/cfe/trunk/unittests/Format/FormatTestObjC.cpp (diff)clang.src/unittests/Format/FormatTestObjC.cpp
Revision 366715 by rampitec:
[AMDGPU] Test update. NFC.
Change TypePath in RepositoryPath in Workspace
The file was modified/llvm/trunk/test/CodeGen/AMDGPU/callee-special-input-vgprs.ll (diff)llvm.src/test/CodeGen/AMDGPU/callee-special-input-vgprs.ll
Revision 366712 by rksimon:
[SLPVectorizer] Fix some MSVC/cppcheck uninitialized variable warnings. NFCI.
Change TypePath in RepositoryPath in Workspace
The file was modified/llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp (diff)llvm.src/lib/Transforms/Vectorize/SLPVectorizer.cpp
Revision 366708 by vlad.tsyrklevich:
Revert "Reland [ELF] Loose a condition for relocation with a symbol"

This reverts commit r366686 as it appears to be causing buildbot
failures on sanitizer-x86_64-linux-android and sanitizer-x86_64-linux.
Change TypePath in RepositoryPath in Workspace
The file was modified/llvm/trunk/lib/MC/ELFObjectWriter.cpp (diff)llvm.src/lib/MC/ELFObjectWriter.cpp
The file was modified/llvm/trunk/test/MC/ELF/basic-elf-32.s (diff)llvm.src/test/MC/ELF/basic-elf-32.s
The file was modified/llvm/trunk/test/MC/ELF/compression.s (diff)llvm.src/test/MC/ELF/compression.s
The file was modified/llvm/trunk/test/MC/ELF/relocation-386.s (diff)llvm.src/test/MC/ELF/relocation-386.s
The file was modified/llvm/trunk/test/MC/Mips/elf-relsym.s (diff)llvm.src/test/MC/Mips/elf-relsym.s
The file was modified/llvm/trunk/test/MC/Mips/xgot.s (diff)llvm.src/test/MC/Mips/xgot.s