[llvm-branch-commits] [cfe-branch] r324718 - Merging r324594:

2018-02-09 Thread Hans Wennborg via llvm-branch-commits
Author: hans
Date: Fri Feb  9 01:01:30 2018
New Revision: 324718

URL: http://llvm.org/viewvc/llvm-project?rev=324718&view=rev
Log:
Merging r324594:

r324594 | aivchenk | 2018-02-08 12:15:21 +0100 (Thu, 08 Feb 2018) | 17 lines

Fix for #31362 - ms_abi is implemented incorrectly for values >=16 bytes.

Summary:
This patch is a fix for following issue:
https://bugs.llvm.org/show_bug.cgi?id=31362 The problem was caused by front end
lowering C calling conventions without taking into account calling conventions
enforced by attribute. In this case win64cc was no correctly lowered on targets
other than Windows.

Reviewed By: rnk (Reid Kleckner)

Differential Revision: https://reviews.llvm.org/D43016

Author: belickim 





Modified:
cfe/branches/release_60/   (props changed)
cfe/branches/release_60/lib/CodeGen/TargetInfo.cpp
cfe/branches/release_60/test/CodeGen/ms_abi.c

Propchange: cfe/branches/release_60/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Feb  9 01:01:30 2018
@@ -1,4 +1,4 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:321754,321771,321777,321779,321933,322018,322236,322245-322246,322350,322390,322405,322420,322518,322593,322813,322901,322904,322984,323008,323123,323155,323360,323485,323904,323935,324059,324134,324246,324419,324439,324514
+/cfe/trunk:321754,321771,321777,321779,321933,322018,322236,322245-322246,322350,322390,322405,322420,322518,322593,322813,322901,322904,322984,323008,323123,323155,323360,323485,323904,323935,324059,324134,324246,324419,324439,324514,324594
 /cfe/trunk/test:170344
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/release_60/lib/CodeGen/TargetInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/branches/release_60/lib/CodeGen/TargetInfo.cpp?rev=324718&r1=324717&r2=324718&view=diff
==
--- cfe/branches/release_60/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/branches/release_60/lib/CodeGen/TargetInfo.cpp Fri Feb  9 01:01:30 2018
@@ -3543,7 +3543,17 @@ ABIArgInfo X86_64ABIInfo::classifyRegCal
 
 void X86_64ABIInfo::computeInfo(CGFunctionInfo &FI) const {
 
-  bool IsRegCall = FI.getCallingConvention() == llvm::CallingConv::X86_RegCall;
+  const unsigned CallingConv = FI.getCallingConvention();
+  // It is possible to force Win64 calling convention on any x86_64 target by
+  // using __attribute__((ms_abi)). In such case to correctly emit Win64
+  // compatible code delegate this call to WinX86_64ABIInfo::computeInfo.
+  if (CallingConv == llvm::CallingConv::Win64) {
+WinX86_64ABIInfo Win64ABIInfo(CGT);
+Win64ABIInfo.computeInfo(FI);
+return;
+  }
+
+  bool IsRegCall = CallingConv == llvm::CallingConv::X86_RegCall;
 
   // Keep track of the number of assigned registers.
   unsigned FreeIntRegs = IsRegCall ? 11 : 6;

Modified: cfe/branches/release_60/test/CodeGen/ms_abi.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/branches/release_60/test/CodeGen/ms_abi.c?rev=324718&r1=324717&r2=324718&view=diff
==
--- cfe/branches/release_60/test/CodeGen/ms_abi.c (original)
+++ cfe/branches/release_60/test/CodeGen/ms_abi.c Fri Feb  9 01:01:30 2018
@@ -146,3 +146,16 @@ void __attribute__((sysv_abi)) f6(__buil
   // WIN64: %[[AP_VAL:.*]] = load i8*, i8** %[[AP]]
   // WIN64-NEXT: store i8* %[[AP_VAL]], i8** %[[AP2:.*]]
 }
+
+// This test checks if structs are passed according to Win64 calling convention
+// when it's enforced by __attribute((ms_abi)).
+struct i128 {
+  unsigned long long a;
+  unsigned long long b;
+};
+
+__attribute__((ms_abi)) struct i128 f7(struct i128 a) {
+  // WIN64: define void @f7(%struct.i128* noalias sret %agg.result, 
%struct.i128* %a)
+  // FREEBSD: define win64cc void @f7(%struct.i128* noalias sret %agg.result, 
%struct.i128* %a)
+  return a;
+}


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [cfe-branch] r324719 - Merging r324537:

2018-02-09 Thread Hans Wennborg via llvm-branch-commits
Author: hans
Date: Fri Feb  9 01:04:00 2018
New Revision: 324719

URL: http://llvm.org/viewvc/llvm-project?rev=324719&view=rev
Log:
Merging r324537:

r324537 | rsmith | 2018-02-07 23:25:16 +0100 (Wed, 07 Feb 2018) | 14 lines

PR36055: fix computation of *-dependence in nested initializer lists.

When we synthesize an implicit inner initializer list when analyzing an outer
initializer list, we add it to the outer list immediately, and then fill in the
inner list. This gives the outer list no chance to update its *-dependence bits
with those of the completed inner list. To fix this, re-add the inner list to
the outer list once it's completed.

Note that we do not recompute the *-dependence bits from scratch when we
complete an outer list; this would give the wrong result for the case where a
designated initializer overwrites a dependent initializer with a non-dependent
one. The resulting list in that case should still be dependent, even though all
traces of the dependence were removed from the semantic form.



Modified:
cfe/branches/release_60/   (props changed)
cfe/branches/release_60/lib/Sema/SemaInit.cpp
cfe/branches/release_60/test/SemaCXX/init-expr-crash.cpp
cfe/branches/release_60/test/SemaTemplate/instantiate-init.cpp

Propchange: cfe/branches/release_60/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Feb  9 01:04:00 2018
@@ -1,4 +1,4 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:321754,321771,321777,321779,321933,322018,322236,322245-322246,322350,322390,322405,322420,322518,322593,322813,322901,322904,322984,323008,323123,323155,323360,323485,323904,323935,324059,324134,324246,324419,324439,324514,324594
+/cfe/trunk:321754,321771,321777,321779,321933,322018,322236,322245-322246,322350,322390,322405,322420,322518,322593,322813,322901,322904,322984,323008,323123,323155,323360,323485,323904,323935,324059,324134,324246,324419,324439,324514,324537,324594
 /cfe/trunk/test:170344
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/release_60/lib/Sema/SemaInit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/branches/release_60/lib/Sema/SemaInit.cpp?rev=324719&r1=324718&r2=324719&view=diff
==
--- cfe/branches/release_60/lib/Sema/SemaInit.cpp (original)
+++ cfe/branches/release_60/lib/Sema/SemaInit.cpp Fri Feb  9 01:04:00 2018
@@ -352,6 +352,7 @@ class InitListChecker {
bool FillWithNoInit = false);
   void FillInEmptyInitializations(const InitializedEntity &Entity,
   InitListExpr *ILE, bool &RequiresSecondPass,
+  InitListExpr *OuterILE, unsigned OuterIndex,
   bool FillWithNoInit = false);
   bool CheckFlexibleArrayInit(const InitializedEntity &Entity,
   Expr *InitExpr, FieldDecl *Field,
@@ -517,12 +518,13 @@ void InitListChecker::FillInEmptyInitFor
 ILE->setInit(Init, BaseInit.getAs());
   } else if (InitListExpr *InnerILE =
  dyn_cast(ILE->getInit(Init))) {
-FillInEmptyInitializations(BaseEntity, InnerILE,
-   RequiresSecondPass, FillWithNoInit);
+FillInEmptyInitializations(BaseEntity, InnerILE, RequiresSecondPass,
+   ILE, Init, FillWithNoInit);
   } else if (DesignatedInitUpdateExpr *InnerDIUE =
dyn_cast(ILE->getInit(Init))) {
 FillInEmptyInitializations(BaseEntity, InnerDIUE->getUpdater(),
-   RequiresSecondPass, /*FillWithNoInit =*/true);
+   RequiresSecondPass, ILE, Init,
+   /*FillWithNoInit =*/true);
   }
 }
 
@@ -605,24 +607,43 @@ void InitListChecker::FillInEmptyInitFor
   } else if (InitListExpr *InnerILE
= dyn_cast(ILE->getInit(Init)))
 FillInEmptyInitializations(MemberEntity, InnerILE,
-   RequiresSecondPass, FillWithNoInit);
+   RequiresSecondPass, ILE, Init, FillWithNoInit);
   else if (DesignatedInitUpdateExpr *InnerDIUE
= dyn_cast(ILE->getInit(Init)))
 FillInEmptyInitializations(MemberEntity, InnerDIUE->getUpdater(),
-   RequiresSecondPass, /*FillWithNoInit =*/ true);
+   RequiresSecondPass, ILE, Init,
+   /*FillWithNoInit =*/true);
 }
 
 /// Recursively replaces NULL values within the given initializer list
 /// with expressions that perform value-initialization of the
-/// appropriate type.
+/// appropriate type, and finish off the InitListExpr formation.
 void
 InitListChecker::FillInEmptyInitializations(const InitializedEntity 

[llvm-branch-commits] [llvm-branch] r324723 - Merging r321911:

2018-02-09 Thread Hans Wennborg via llvm-branch-commits
Author: hans
Date: Fri Feb  9 02:04:11 2018
New Revision: 324723

URL: http://llvm.org/viewvc/llvm-project?rev=324723&view=rev
Log:
Merging r321911:

r321911 | amccarth | 2018-01-06 00:01:04 +0100 (Sat, 06 Jan 2018) | 9 lines

Re-land "Fix faulty assertion in debug info"

This had been reverted because the new test failed on non-X86 bots.  I moved
the new test to the appropriate subdirectory to correct this.

Differential Revision: https://reviews.llvm.org/D41264
Original submission:  r321122 (which was reverted by r321125)

This reverts commit 3c1639b5703c387a0d8cba2862803b4e68dff436.


Added:
llvm/branches/release_60/test/DebugInfo/X86/void-typedef.ll
  - copied unchanged from r321911, 
llvm/trunk/test/DebugInfo/X86/void-typedef.ll
Modified:
llvm/branches/release_60/   (props changed)
llvm/branches/release_60/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
llvm/branches/release_60/lib/CodeGen/AsmPrinter/DwarfUnit.cpp

Propchange: llvm/branches/release_60/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Feb  9 02:04:11 2018
@@ -1,3 +1,3 @@
 /llvm/branches/Apple/Pertwee:110850,110961
 /llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,321751,321789,321791,321806,321862,321870,321872,321878,321980,321991,321993-321994,322003,322016,322053,322056,322103,322106,322108,322123,322131,33,322272,322313,322372,322473,322623,322644,322724,322767,322875,322878-322879,322900,322904-322905,322973,322993,323034,323155,323190,323307,323331,323355,323369,323371,323384,323469,323515,323536,323582,323643,323671-323672,323706,323710,323759,323781,323810-323811,323813,323857,323907-323909,323913,323915,324002,324039,324422
+/llvm/trunk:155241,321751,321789,321791,321806,321862,321870,321872,321878,321911,321980,321991,321993-321994,322003,322016,322053,322056,322103,322106,322108,322123,322131,33,322272,322313,322372,322473,322623,322644,322724,322767,322875,322878-322879,322900,322904-322905,322973,322993,323034,323155,323190,323307,323331,323355,323369,323371,323384,323469,323515,323536,323582,323643,323671-323672,323706,323710,323759,323781,323810-323811,323813,323857,323907-323909,323913,323915,324002,324039,324422

Modified: llvm/branches/release_60/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/branches/release_60/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp?rev=324723&r1=324722&r2=324723&view=diff
==
--- llvm/branches/release_60/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp 
(original)
+++ llvm/branches/release_60/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp Fri 
Feb  9 02:04:11 2018
@@ -163,7 +163,8 @@ uint64_t DebugHandlerBase::getBaseTypeSi
 
   DIType *BaseType = DDTy->getBaseType().resolve();
 
-  assert(BaseType && "Unexpected invalid base type");
+  if (!BaseType)
+return 0;
 
   // If this is a derived type, go ahead and get the base type, unless it's a
   // reference then it's just the size of the field. Pointer types have no need

Modified: llvm/branches/release_60/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/branches/release_60/lib/CodeGen/AsmPrinter/DwarfUnit.cpp?rev=324723&r1=324722&r2=324723&view=diff
==
--- llvm/branches/release_60/lib/CodeGen/AsmPrinter/DwarfUnit.cpp (original)
+++ llvm/branches/release_60/lib/CodeGen/AsmPrinter/DwarfUnit.cpp Fri Feb  9 
02:04:11 2018
@@ -1391,7 +1391,8 @@ void DwarfUnit::constructMemberDIE(DIE &
   if (!Name.empty())
 addString(MemberDie, dwarf::DW_AT_name, Name);
 
-  addType(MemberDie, resolve(DT->getBaseType()));
+  if (DIType *Resolved = resolve(DT->getBaseType()))
+addType(MemberDie, Resolved);
 
   addSourceLine(MemberDie, DT);
 


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits