SuccessChanges

Summary

  1. [Attributor] NoAlias on return values. Porting function return value attribute noalias to attributor. This will be followed with a patch for callsite and function argumets. Reviewers: jdoerfert Subscribers: lebedev.ri, hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D63067
  2. Stubs out TLOF for AIX and add support for common vars in assembly output. Stubs out a TargetLoweringObjectFileXCOFF class, implementing only SelectSectionForGlobal for common symbols. Also adds an override of EmitGlobalVariable in PPCAIXAsmPrinter which adds a number of defensive errors and adds support for emitting common globals.
  3. [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
  4. 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
  5. [PowerPC] Fix comment on MO_PLT Target Operand Flag. [NFC] Patch by Xiangling Liao.
  6. [Object][XCOFF] Remove extra includes from XCOFF related files. [NFC] Differential Revision: https://reviews.llvm.org/D60885
  7. 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
Revision 366728 by sstefan:
[Attributor] NoAlias on return values.

Porting function return value attribute noalias to attributor.
This will be followed with a patch for callsite and function argumets.

Reviewers: jdoerfert

Subscribers: lebedev.ri, hiraditya, llvm-commits

Differential Revision: https://reviews.llvm.org/D63067
Change TypePath in RepositoryPath in Workspace
The file was modified/llvm/trunk/include/llvm/Transforms/IPO/Attributor.h (diff)llvm.src/include/llvm/Transforms/IPO/Attributor.h
The file was modified/llvm/trunk/lib/Transforms/IPO/Attributor.cpp (diff)llvm.src/lib/Transforms/IPO/Attributor.cpp
The file was added/llvm/trunk/test/Transforms/FunctionAttrs/noalias_returned.llllvm.src/test/Transforms/FunctionAttrs/noalias_returned.ll
The file was modified/llvm/trunk/test/Transforms/FunctionAttrs/nonnull.ll (diff)llvm.src/test/Transforms/FunctionAttrs/nonnull.ll
Revision 366727 by sfertile:
Stubs out TLOF for AIX and add support for common vars in assembly output.

Stubs out a TargetLoweringObjectFileXCOFF class, implementing only
SelectSectionForGlobal for common symbols. Also adds an override of
EmitGlobalVariable in PPCAIXAsmPrinter which adds a number of defensive errors
and adds support for emitting common globals.
Change TypePath in RepositoryPath in Workspace
The file was modified/llvm/trunk/include/llvm/BinaryFormat/XCOFF.h (diff)llvm.src/include/llvm/BinaryFormat/XCOFF.h
The file was modified/llvm/trunk/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h (diff)llvm.src/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
The file was modified/llvm/trunk/include/llvm/MC/MCContext.h (diff)llvm.src/include/llvm/MC/MCContext.h
The file was modified/llvm/trunk/include/llvm/MC/MCSectionXCOFF.h (diff)llvm.src/include/llvm/MC/MCSectionXCOFF.h
The file was modified/llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp (diff)llvm.src/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
The file was modified/llvm/trunk/lib/MC/MCAsmInfoXCOFF.cpp (diff)llvm.src/lib/MC/MCAsmInfoXCOFF.cpp
The file was modified/llvm/trunk/lib/MC/MCContext.cpp (diff)llvm.src/lib/MC/MCContext.cpp
The file was modified/llvm/trunk/lib/MC/MCObjectFileInfo.cpp (diff)llvm.src/lib/MC/MCObjectFileInfo.cpp
The file was modified/llvm/trunk/lib/MC/MCSectionXCOFF.cpp (diff)llvm.src/lib/MC/MCSectionXCOFF.cpp
The file was modified/llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp (diff)llvm.src/lib/Target/PowerPC/PPCAsmPrinter.cpp
The file was modified/llvm/trunk/lib/Target/PowerPC/PPCTargetMachine.cpp (diff)llvm.src/lib/Target/PowerPC/PPCTargetMachine.cpp
The file was added/llvm/trunk/test/CodeGen/PowerPC/aix-xcoff-common.llllvm.src/test/CodeGen/PowerPC/aix-xcoff-common.ll
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