Re: [PATCH] D11932: [OPENMP] Link libomp.lib on Windows

2015-08-16 Thread İsmail Dönmez via cfe-commits
ismail added a comment.

In http://reviews.llvm.org/D11932#225158, @hfinkel wrote:

 What library path should be passed (where did you build the OpenMP runtime 
 library)?


This is a default installation so the lib path is $PATH_TO_CLANG_EXE/../lib 
which in my case is C:\Program Files\LLVM\lib


http://reviews.llvm.org/D11932



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


Re: [PATCH] D12052: [X86][SSE] Add _mm_undefined_* intrinsics

2015-08-16 Thread Michael Kuperstein via cfe-commits
mkuper added a comment.

Thanks, Simon!
I've wanted to add the _undefined intrinsics for a while now, but never got to 
it.

Anyway, this sort of implementation somewhat worries me. 
Yes, I know that the gcc intrinsics do something very similar. 
And I also know that in practice we'll get an undef value, nothing worse 
(assuming reading an uninitialized automatic variable is undefined behavior to 
begin with - which really depends on the spec interpretation :-) ). 
And I know this isn't likely to change anytime soon.

Still, relying on what may be undefined behavior in the header files worries 
me, and I'd rather not have it implemented like that.
I was thinking about adding a __builtin_undef which explicitly resolves to an 
undef value. 
Does that make sense to you?



Comment at: test/CodeGen/sse-undefined.c:1
@@ +1,2 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -o - | not grep xmm
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -o - | not grep ymm

Perhaps a more explicit test?


Repository:
  rL LLVM

http://reviews.llvm.org/D12052



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


Re: [PATCH] D5102: [analyzer][Bugfix/improvement] Fix for PR16833

2015-08-16 Thread Aleksei Sidorin via cfe-commits
a.sidorin added inline comments.


Comment at: lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp:215-220
@@ +214,8 @@
+  return assumeSymWithinInclusiveRange(State, Sym, From, To, InRange);
+return State;
+  } // end switch
+
+  case nonloc::ConcreteIntKind: {
+const llvm::APSInt IntVal = 
Value.castAsnonloc::ConcreteInt().getValue();
+bool IsInRange = IntVal = From  IntVal = To;
+bool isFeasible = (IsInRange == InRange);

jordan_rose wrote:
 This is still relevant.
Both types are equal for CaseStmt. But I'll check this code anyway because I 
found an interesting issue in CFG for SwitchStmt and I'm still investigating it.


http://reviews.llvm.org/D5102



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


Re: [PATCH] D12052: [X86][SSE] Add _mm_undefined_* intrinsics

2015-08-16 Thread Simon Pilgrim via cfe-commits
RKSimon added a comment.

Yes using that uninitialized value has worried me as well. I originally set it 
to zero (and considered using __ LINE __ or __ COUNTER __) but both introduce 
defined behaviour that I could see causing all sorts of problems further down 
the line in debug vs release builds. How undefined do we want our undefined to 
be? ;-)

I can create __builtin_ia32_undef64mmx / __builtin_ia32_undef128 / 
__builtin_ia32_undef256 / __builtin_ia32_undef512 if nobody can think of a 
better alternative?


Repository:
  rL LLVM

http://reviews.llvm.org/D12052



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


Re: [PATCH] D5102: [analyzer][Bugfix/improvement] Fix for PR16833

2015-08-16 Thread Aleksei Sidorin via cfe-commits
a.sidorin added a comment.

Thank you for reply, Jordan.

 I guess the regular pings didn't work, so it was worth trying the gentle one? 
 Sorry!


And it worked :)

I'll fix the issues you pointed.


http://reviews.llvm.org/D5102



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


Re: [PATCH] D11859: Generating vptr assume loads

2015-08-16 Thread Piotr Padlewski via cfe-commits
Prazek added a comment.

In http://reviews.llvm.org/D11859#225025, @rjmccall wrote:

 Mostly LGTM.  Are you going to emit assumptions for vbptrs in a separate 
 patch?


I wasn't planning to. I am focusing now on upgrading GVN for using new 
invariant.barrier metadata.


http://reviews.llvm.org/D11859



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


Re: [PATCH] D11859: Generating vptr assume loads

2015-08-16 Thread John McCall via cfe-commits
rjmccall added a comment.

In http://reviews.llvm.org/D11859#225384, @Prazek wrote:

 In http://reviews.llvm.org/D11859#225025, @rjmccall wrote:

  Mostly LGTM.  Are you going to emit assumptions for vbptrs in a separate 
  patch?


 I wasn't planning to. I am focusing now on upgrading GVN for using new 
 invariant.barrier metadata.


I won't argue with prioritizing Itanium over MS work, if that's your 
motivation, because that's obviously your call to make, and certainly that's 
how I would weigh things if I were doing this work.  If you're interested in 
both, though, I would guess that vbptr assumptions would be particularly 
valuable — constructing objects and immediately converting them to a base class 
is pretty common in a lot of idioms.


http://reviews.llvm.org/D11859



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


Re: [PATCH] D11859: Generating vptr assume loads

2015-08-16 Thread Piotr Padlewski via cfe-commits
Prazek marked an inline comment as done.


Comment at: lib/CodeGen/CGCXXABI.h:352
@@ +351,3 @@
+  isVirtualOffsetNeededForVTableField(CodeGenFunction CGF,
+  const CXXRecordDecl *NearestVBase) = 0;
+

rjmccall wrote:
 This method does not need to be passed a CodeGenFunction, but it should take 
 a complete CodeGenFunction::VPtr, not just this one random field from it.
yep, I thought that there will be problem with placing VPtr class, but I 
haven't noticed that CGCXXAABI includes CodeGenFunction.

CodeGenFunction is required for ItaniumABI 
return NeedsVTTParameter(CGF.CurGD);


Comment at: lib/CodeGen/CGClass.cpp:1862
@@ +1861,3 @@
+  for (const VPtr vptr : getVTablePointers(ClassDecl))
+if (CGM.getCXXABI().canInitializeVPtr(vptr.VTableClass, 
vptr.Base.getBase(),
+  vptr.NearestVBase))

rjmccall wrote:
 As mentioned elsewhere, you can skip this entire loop if 
 doStructorsInitializeVTables returns false.
hmm, I think it is not true. This code checks if each base that we are 
initilizing/generating vptr assumption don't have novtable specifier. If one 
base has it, it doesn't mean that we don't have to do it for other base


http://reviews.llvm.org/D11859



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


r245184 - Enable passing test on Windows + MSYS.

2015-08-16 Thread Yaron Keren via cfe-commits
Author: yrnkrn
Date: Sun Aug 16 14:02:49 2015
New Revision: 245184

URL: http://llvm.org/viewvc/llvm-project?rev=245184view=rev
Log:
Enable passing test on Windows + MSYS.


Modified:
cfe/trunk/test/Preprocessor/macro-multiline.c

Modified: cfe/trunk/test/Preprocessor/macro-multiline.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/macro-multiline.c?rev=245184r1=245183r2=245184view=diff
==
--- cfe/trunk/test/Preprocessor/macro-multiline.c (original)
+++ cfe/trunk/test/Preprocessor/macro-multiline.c Sun Aug 16 14:02:49 2015
@@ -1,5 +1,4 @@
 // RUN: printf -- -DX=A\nTHIS_SHOULD_NOT_EXIST_IN_THE_OUTPUT | xargs -0 
%clang -E %s | FileCheck -strict-whitespace %s
-// REQUIRES: shell
 
 // Per GCC -D semantics, \n and anything that follows is ignored.
 


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


Re: [PATCH] D11859: Generating vptr assume loads

2015-08-16 Thread Piotr Padlewski via cfe-commits
Prazek updated this revision to Diff 32262.

http://reviews.llvm.org/D11859

Files:
  lib/CodeGen/CGCXXABI.h
  lib/CodeGen/CGClass.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/CodeGen/ItaniumCXXABI.cpp
  lib/CodeGen/MicrosoftCXXABI.cpp
  test/CodeGen/available-externally-hidden.cpp
  test/CodeGenCXX/ctor-globalopt.cpp
  test/CodeGenCXX/template-instantiation.cpp
  test/CodeGenCXX/thunks.cpp
  test/CodeGenCXX/virtual-base-ctor.cpp
  test/CodeGenCXX/vtable-assume-load.cpp
  test/CodeGenCXX/vtable-available-externally.cpp

Index: test/CodeGenCXX/vtable-available-externally.cpp
===
--- test/CodeGenCXX/vtable-available-externally.cpp
+++ test/CodeGenCXX/vtable-available-externally.cpp
@@ -182,8 +182,8 @@
 namespace Test9 {
 // all virtual functions are outline, so we can assume that it will
 // be generated in translation unit where foo is defined
-// CHECK-TEST9: @_ZTVN5Test91AE = available_externally unnamed_addr constant
-// CHECK-TEST9: @_ZTVN5Test91BE = available_externally unnamed_addr constant
+// CHECK-TEST9-DAG: @_ZTVN5Test91AE = available_externally unnamed_addr constant
+// CHECK-TEST9-DAG: @_ZTVN5Test91BE = available_externally unnamed_addr constant
 struct A {
   virtual void foo();
   virtual void bar();
@@ -206,39 +206,39 @@
 namespace Test10 {
 
 // because A's key function is defined here, vtable is generated in this TU
-// CHECK-TEST10: @_ZTVN6Test101AE = unnamed_addr constant
+// CHECK-TEST10-DAG: @_ZTVN6Test101AE = unnamed_addr constant
 struct A {
   virtual void foo();
   virtual void bar();
 };
 void A::foo() {}
 
 // Because key function is inline we will generate vtable as linkonce_odr
-// CHECK-TEST10: @_ZTVN6Test101DE = linkonce_odr unnamed_addr constant
+// CHECK-TEST10-DAG: @_ZTVN6Test101DE = linkonce_odr unnamed_addr constant
 struct D : A {
   void bar();
 };
 inline void D::bar() {}
 
 // because B has outline key function then we can refer to
-// CHECK-TEST10: @_ZTVN6Test101BE = available_externally unnamed_addr constant
+// CHECK-TEST10-DAG: @_ZTVN6Test101BE = available_externally unnamed_addr constant
 struct B : A {
   void foo();
   void bar();
 };
 
 // C's key function (car) is outline, but C has inline virtual function so we
 // can't guarantee that we will be able to refer to bar from name
 // so (at the moment) we can't emit vtable available_externally
-// CHECK-TEST10: @_ZTVN6Test101CE = external unnamed_addr constant
+// CHECK-TEST10-DAG: @_ZTVN6Test101CE = external unnamed_addr constant
 struct C : A {
   void bar() {}   // defined in body - not key function
   virtual inline void gar();  // inline in body - not key function
   virtual void car();
 };
 
 // no key function, vtable will be generated everywhere it will be used
-// CHECK-TEST10: @_ZTVN6Test101EE = linkonce_odr unnamed_addr constant
+// CHECK-TEST10-DAG: @_ZTVN6Test101EE = linkonce_odr unnamed_addr constant
 struct E : A {};
 
 void g(A a) {
Index: test/CodeGenCXX/vtable-assume-load.cpp
===
--- /dev/null
+++ test/CodeGenCXX/vtable-assume-load.cpp
@@ -0,0 +1,173 @@
+// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -emit-llvm -o %t.ll -O1 -disable-llvm-optzns -fms-extensions
+// RUN: %clang_cc1 %s -triple i686-pc-win32 -emit-llvm -o %t.ms.ll -O1 -disable-llvm-optzns -fms-extensions
+
+// RUN: FileCheck --check-prefix=CHECK1 --input-file=%t.ll %s
+// RUN: FileCheck --check-prefix=CHECK2 --input-file=%t.ll %s
+// RUN: FileCheck --check-prefix=CHECK3 --input-file=%t.ll %s
+// RUN: FileCheck --check-prefix=CHECK4 --input-file=%t.ll %s
+// RUN: FileCheck --check-prefix=CHECK-MS --input-file=%t.ms.ll %s
+
+namespace test1 {
+
+struct A {
+  A();
+  virtual void foo();
+};
+
+struct B : A {
+  virtual void foo();
+};
+
+void g(A *a) { a-foo(); }
+
+// CHECK1-LABEL: define void @_ZN5test14fooAEv()
+// CHECK1: call void @_ZN5test11AC1Ev(%struct.test1::A* %a)
+// CHECK1: %vtable = load i8**, i8*** %1
+// CHECK1: %cmp.vtables = icmp eq i8** %vtable, getelementptr inbounds ([3 x i8*], [3 x i8*]* @_ZTVN5test11AE, i64 0, i64 2)
+// CHECK1: call void @llvm.assume(i1 %cmp.vtables)
+// CHECK1-LABEL: }
+
+void fooA() {
+  A a;
+  g(a);
+}
+
+// CHECK1-LABEL: define void @_ZN5test14fooBEv()
+// CHECK1: call void @_ZN5test11BC1Ev(%struct.test1::B* %b)
+// CHECK1: %vtable = load i8**, i8*** %1
+// CHECK1: %cmp.vtables = icmp eq i8** %vtable, getelementptr inbounds ([3 x i8*], [3 x i8*]* @_ZTVN5test11BE, i64 0, i64 2)
+// CHECK1: call void @llvm.assume(i1 %cmp.vtables)
+// CHECK1-LABEL: }
+
+void fooB() {
+  B b;
+  g(b);
+}
+// there should not be any assumes in the ctor that calls base ctor
+// CHECK1-LABEL: define linkonce_odr void @_ZN5test11BC2Ev(%struct.test1::B* %this)
+// CHECK1-NOT: @llvm.assume(
+// CHECK1-LABEL: }
+}
+namespace test2 {
+struct A {
+  A();
+  virtual void foo();
+};
+
+struct B {
+  B();
+  virtual void bar();
+};
+
+struct C : A, B {
+  C();
+  virtual void 

Re: [PATCH] D11851: clang-format: Add AllowShortNamespacesOnASingleLine option

2015-08-16 Thread Chris Beck via cfe-commits
cbeck88 removed rL LLVM as the repository for this revision.
cbeck88 updated this revision to Diff 32249.
cbeck88 added a comment.

- Fixed formatting in header
- Fixed handling of nested namespaces
- Added unit tests

djasper: I thought about it, I guess I don't have a particularly good reason 
that the namespaces logic should be a separate function from 
tryMergeSimpleBlock, and maybe it should indeed be refactored to be part of 
the case analysis of that function. When I began I thought this would just be 
simpler and make it easier to customize the namespace handling vs. other 
blocks, but now I'm less sure of this. At least with the way I'm now trying to 
handle the nested namespaces, this seems a bit simpler, but maybe that part 
should be changed.


http://reviews.llvm.org/D11851

Files:
  include/clang/Format/Format.h
  lib/Format/Format.cpp
  lib/Format/UnwrappedLineFormatter.cpp
  unittests/Format/FormatTest.cpp

Index: unittests/Format/FormatTest.cpp
===
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -3226,16 +3226,19 @@
   Style.MacroBlockEnd = ^[A-Z_]+_END$;
   verifyFormat(FOO_BEGIN\n
  FOO_ENTRY\n
-   FOO_END, Style);
+   FOO_END,
+   Style);
   verifyFormat(FOO_BEGIN\n
  NESTED_FOO_BEGIN\n
NESTED_FOO_ENTRY\n
  NESTED_FOO_END\n
-   FOO_END, Style);
+   FOO_END,
+   Style);
   verifyFormat(FOO_BEGIN(Foo, Bar)\n
  int x;\n
  x = 1;\n
-   FOO_END(Baz), Style);
+   FOO_END(Baz),
+   Style);
 }
 
 //===--===//
@@ -7649,14 +7652,13 @@
 
   // Verify that splitting the strings understands
   // Style::AlwaysBreakBeforeMultilineStrings.
-  EXPECT_EQ(
-  (\n
-  \aa aa \\n
-  \aa aa\);,
-  format((\aa 
- aa aa 
- aa\);,
- getGoogleStyle()));
+  EXPECT_EQ((\n
+\aa aa \\n
+\aa aa\);,
+format((\aa 
+   aa aa 
+   aa\);,
+   getGoogleStyle()));
   EXPECT_EQ(return \aa aa \\n
\aa aa\;,
 format(return \aa 
@@ -10433,6 +10435,45 @@
   verifyNoCrash(#define a\\\n /**/});
 }
 
+TEST_F(FormatTest, ShortNamespacesOption) {
+  FormatStyle style = getLLVMStyle();
+  style.AllowShortNamespacesOnASingleLine = true;
+
+  verifyFormat(namespace foo { class bar; }, style);
+  verifyFormat(namespace foo {\n
+   class bar;\n
+   class baz;\n
+   },
+   style);
+  verifyFormat(namespace foo { namespace bar { class baz; } }, style);
+  verifyFormat(namespace foo {\n
+   namespace bar { class baz; }\n
+   namespace quar { class quaz; }\n
+   },
+   style);
+  verifyFormat(namespace foo {\n
+   int f() { return 5; }\n
+   },
+   style);
+  verifyFormat(namespace foo { template T struct bar; }, style);
+  verifyFormat(namespace foo { constexpr int num = 42; }, style);
+
+  // test column limit
+  verifyFormat(namespace boost {\n
+   namespace spirit {\n
+   namespace qi {\n
+   namespace unicode { namespace foo { class bar; } }\n
+   }\n
+   }\n
+   },
+   style);
+
+  style.ColumnLimit = 0;
+  verifyFormat(namespace boost { namespace spirit { namespace qi { namespace 
+   unicode { namespace foo { class bar; } } } } },
+   style);
+}
+
 } // end namespace
 } // end namespace format
 } // end namespace clang
Index: lib/Format/UnwrappedLineFormatter.cpp
===
--- lib/Format/UnwrappedLineFormatter.cpp
+++ lib/Format/UnwrappedLineFormatter.cpp
@@ -199,6 +199,11 @@
   return MergeShortFunctions ? tryMergeSimpleBlock(I, E, Limit) : 0;
 }
 if (TheLine-Last-is(tok::l_brace)) {
+  if (Style.AllowShortNamespacesOnASingleLine 
+  TheLine-First-is(tok::kw_namespace)) {
+if (unsigned result = tryMergeNamespace(I, E, Limit))
+  return result;
+  }
   return Style.BreakBeforeBraces == FormatStyle::BS_Attach
  ? tryMergeSimpleBlock(I, E, 

Re: [PATCH] D11859: Generating vptr assume loads

2015-08-16 Thread Piotr Padlewski via cfe-commits
Prazek updated this revision to Diff 32263.

http://reviews.llvm.org/D11859

Files:
  lib/CodeGen/CGCXXABI.h
  lib/CodeGen/CGClass.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/CodeGen/ItaniumCXXABI.cpp
  lib/CodeGen/MicrosoftCXXABI.cpp
  test/CodeGen/available-externally-hidden.cpp
  test/CodeGenCXX/ctor-globalopt.cpp
  test/CodeGenCXX/template-instantiation.cpp
  test/CodeGenCXX/thunks.cpp
  test/CodeGenCXX/virtual-base-ctor.cpp
  test/CodeGenCXX/vtable-assume-load.cpp
  test/CodeGenCXX/vtable-available-externally.cpp

Index: test/CodeGenCXX/vtable-available-externally.cpp
===
--- test/CodeGenCXX/vtable-available-externally.cpp
+++ test/CodeGenCXX/vtable-available-externally.cpp
@@ -182,8 +182,8 @@
 namespace Test9 {
 // all virtual functions are outline, so we can assume that it will
 // be generated in translation unit where foo is defined
-// CHECK-TEST9: @_ZTVN5Test91AE = available_externally unnamed_addr constant
-// CHECK-TEST9: @_ZTVN5Test91BE = available_externally unnamed_addr constant
+// CHECK-TEST9-DAG: @_ZTVN5Test91AE = available_externally unnamed_addr constant
+// CHECK-TEST9-DAG: @_ZTVN5Test91BE = available_externally unnamed_addr constant
 struct A {
   virtual void foo();
   virtual void bar();
@@ -206,39 +206,39 @@
 namespace Test10 {
 
 // because A's key function is defined here, vtable is generated in this TU
-// CHECK-TEST10: @_ZTVN6Test101AE = unnamed_addr constant
+// CHECK-TEST10-DAG: @_ZTVN6Test101AE = unnamed_addr constant
 struct A {
   virtual void foo();
   virtual void bar();
 };
 void A::foo() {}
 
 // Because key function is inline we will generate vtable as linkonce_odr
-// CHECK-TEST10: @_ZTVN6Test101DE = linkonce_odr unnamed_addr constant
+// CHECK-TEST10-DAG: @_ZTVN6Test101DE = linkonce_odr unnamed_addr constant
 struct D : A {
   void bar();
 };
 inline void D::bar() {}
 
 // because B has outline key function then we can refer to
-// CHECK-TEST10: @_ZTVN6Test101BE = available_externally unnamed_addr constant
+// CHECK-TEST10-DAG: @_ZTVN6Test101BE = available_externally unnamed_addr constant
 struct B : A {
   void foo();
   void bar();
 };
 
 // C's key function (car) is outline, but C has inline virtual function so we
 // can't guarantee that we will be able to refer to bar from name
 // so (at the moment) we can't emit vtable available_externally
-// CHECK-TEST10: @_ZTVN6Test101CE = external unnamed_addr constant
+// CHECK-TEST10-DAG: @_ZTVN6Test101CE = external unnamed_addr constant
 struct C : A {
   void bar() {}   // defined in body - not key function
   virtual inline void gar();  // inline in body - not key function
   virtual void car();
 };
 
 // no key function, vtable will be generated everywhere it will be used
-// CHECK-TEST10: @_ZTVN6Test101EE = linkonce_odr unnamed_addr constant
+// CHECK-TEST10-DAG: @_ZTVN6Test101EE = linkonce_odr unnamed_addr constant
 struct E : A {};
 
 void g(A a) {
Index: test/CodeGenCXX/vtable-assume-load.cpp
===
--- /dev/null
+++ test/CodeGenCXX/vtable-assume-load.cpp
@@ -0,0 +1,173 @@
+// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -emit-llvm -o %t.ll -O1 -disable-llvm-optzns -fms-extensions
+// RUN: %clang_cc1 %s -triple i686-pc-win32 -emit-llvm -o %t.ms.ll -O1 -disable-llvm-optzns -fms-extensions
+
+// RUN: FileCheck --check-prefix=CHECK1 --input-file=%t.ll %s
+// RUN: FileCheck --check-prefix=CHECK2 --input-file=%t.ll %s
+// RUN: FileCheck --check-prefix=CHECK3 --input-file=%t.ll %s
+// RUN: FileCheck --check-prefix=CHECK4 --input-file=%t.ll %s
+// RUN: FileCheck --check-prefix=CHECK-MS --input-file=%t.ms.ll %s
+
+namespace test1 {
+
+struct A {
+  A();
+  virtual void foo();
+};
+
+struct B : A {
+  virtual void foo();
+};
+
+void g(A *a) { a-foo(); }
+
+// CHECK1-LABEL: define void @_ZN5test14fooAEv()
+// CHECK1: call void @_ZN5test11AC1Ev(%struct.test1::A* %a)
+// CHECK1: %vtable = load i8**, i8*** %1
+// CHECK1: %cmp.vtables = icmp eq i8** %vtable, getelementptr inbounds ([3 x i8*], [3 x i8*]* @_ZTVN5test11AE, i64 0, i64 2)
+// CHECK1: call void @llvm.assume(i1 %cmp.vtables)
+// CHECK1-LABEL: }
+
+void fooA() {
+  A a;
+  g(a);
+}
+
+// CHECK1-LABEL: define void @_ZN5test14fooBEv()
+// CHECK1: call void @_ZN5test11BC1Ev(%struct.test1::B* %b)
+// CHECK1: %vtable = load i8**, i8*** %1
+// CHECK1: %cmp.vtables = icmp eq i8** %vtable, getelementptr inbounds ([3 x i8*], [3 x i8*]* @_ZTVN5test11BE, i64 0, i64 2)
+// CHECK1: call void @llvm.assume(i1 %cmp.vtables)
+// CHECK1-LABEL: }
+
+void fooB() {
+  B b;
+  g(b);
+}
+// there should not be any assumes in the ctor that calls base ctor
+// CHECK1-LABEL: define linkonce_odr void @_ZN5test11BC2Ev(%struct.test1::B* %this)
+// CHECK1-NOT: @llvm.assume(
+// CHECK1-LABEL: }
+}
+namespace test2 {
+struct A {
+  A();
+  virtual void foo();
+};
+
+struct B {
+  B();
+  virtual void bar();
+};
+
+struct C : A, B {
+  C();
+  virtual void 

Re: [PATCH] D11361: [OpenMP] Target directive host codegen

2015-08-16 Thread Alexey Bataev via cfe-commits
ABataev added inline comments.


Comment at: lib/CodeGen/CGExpr.cpp:1969
@@ -1945,3 +1968,3 @@
 else
-  return EmitCapturedFieldLValue(*this, CapturedStmtInfo-lookup(VD),
- CapturedStmtInfo-getContextValue());
+  return EmitCapturedValue(*this, CapturedStmtInfo-lookup(VD),
+   CapturedStmtInfo-getContextValue());

Samuel, why you don't want to capture all used variables in CapturedDecl 
instead of creating ImplicitParamDecl for each captured variable? Also, you 
will solve possible trouble with VLAs automatically using CapturedDecl.


Comment at: lib/CodeGen/CGOpenMPRuntime.cpp:2953
@@ +2952,3 @@
+  BasePointer = Pointer = LV.getAddress();
+  uint64_t SizeVal = CGM.getContext().getTypeSize(ri-getType()) / 8;
+  Size = CGF.Builder.getInt64(SizeVal);

Use CGM.getContext().getTypeSizeInChars() instead of 
CGM.getContext().getTypeSize() / 8.


Comment at: lib/CodeGen/CGOpenMPRuntime.cpp:2954
@@ +2953,3 @@
+  uint64_t SizeVal = CGM.getContext().getTypeSize(ri-getType()) / 8;
+  Size = CGF.Builder.getInt64(SizeVal);
+

Maybe llvm::ConstantInt::get(CGF.SizeTy, SizeVal)?


Comment at: lib/CodeGen/CGOpenMPRuntime.cpp:2963
@@ +2962,3 @@
+  uint64_t SizeVal =
+  CGM.getContext().getTypeSize(PtrTy-getPointeeType()) / 8;
+  Size = CGF.Builder.getInt64(SizeVal);

Use CGM.getContext().getTypeSizeInChars() instead of 
CGM.getContext().getTypeSize() / 8.


Comment at: lib/CodeGen/CGOpenMPRuntime.cpp:2980
@@ +2979,3 @@
+uint64_t ElementTypeSize =
+CGM.getContext().getTypeSize(ElementType) / 8;
+Size = CGF.Builder.getInt64(ElementTypeSize);

The same


Comment at: lib/CodeGen/CGStmtOpenMP.cpp:2144-2145
@@ +2143,4 @@
+  auto *ThisRef = LocalDeclMap[*pi];
+  LValue Addr = LValue::MakeAddr(ThisRef, ri-getType(), CharUnits(),
+ CGM.getContext());
+  CXXThisValue = EmitLoadOfLValue(Addr, CS.getLocStart()).getScalarVal();

MakeNaturalAlignAddrLValue(ThisRef, ri-getType())?


Comment at: lib/CodeGen/CGStmtOpenMP.cpp:2147
@@ +2146,3 @@
+  CXXThisValue = EmitLoadOfLValue(Addr, CS.getLocStart()).getScalarVal();
+  ;
+  continue;

Extra semicolon


http://reviews.llvm.org/D11361



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


Re: r245041 - [OPENMP] Fix for http://llvm.org/PR24371: Assert failure compiling blender 2.75.

2015-08-16 Thread Bataev, Alexey via cfe-commits

Yes, please, forget to tell you. :)

Best regards,
Alexey Bataev
=
Software Engineer
Intel Compiler Team

14.08.2015 19:03, Hans Wennborg пишет:

On Fri, Aug 14, 2015 at 5:25 AM, Alexey Bataev via cfe-commits
cfe-commits@lists.llvm.org wrote:

Author: abataev
Date: Fri Aug 14 07:25:37 2015
New Revision: 245041

URL: http://llvm.org/viewvc/llvm-project?rev=245041view=rev
Log:
[OPENMP] Fix for http://llvm.org/PR24371: Assert failure compiling blender 2.75.
blender uses statements expression in condition of the loop under control of 
the '#pragma omp parallel for'. This condition is used several times in 
different expressions required for codegen of the loop directive. If there are 
some variables defined in statement expression, it fires an assert during 
codegen because of redefinition of the same variables.
We have to rebuild several expression to be sure that all variables are unique.

Should we merge this to 3.7?


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