[PATCH] D144164: [clang][Interp] Handle PtrMemOps

2023-06-15 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added a comment.

Ping


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144164/new/

https://reviews.llvm.org/D144164

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


[PATCH] D151696: [x86] Remove CPU_SPECIFIC* MACROs and add getManglingForCPU

2023-06-15 Thread Freddy, Ye via Phabricator via cfe-commits
FreddyYe marked 2 inline comments as done.
FreddyYe added inline comments.



Comment at: llvm/test/CodeGen/X86/cpus-intel.ll:26
 ; RUN: llc < %s -o /dev/null -mtriple=i686-unknown-unknown -mcpu=emeraldrapids 
2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty
+; RUN: llc < %s -o /dev/null -mtriple=i686-unknown-unknown -mcpu=generic 2>&1 
| FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty
+; RUN: llc < %s -o /dev/null -mtriple=i686-unknown-unknown -mcpu=pentium_ii 
2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty

RKSimon wrote:
> Keeping all the aliased cpus variants RUN together will make maintenance 
> easier (e.g. pentium_mmx)
Updated, not sure if I understood your point. pls review again.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151696/new/

https://reviews.llvm.org/D151696

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


[PATCH] D151696: [x86] Remove CPU_SPECIFIC* MACROs and add getManglingForCPU

2023-06-15 Thread Freddy, Ye via Phabricator via cfe-commits
FreddyYe updated this revision to Diff 531993.
FreddyYe added a comment.

1. Update generic and pentium Features to align with X86.td.
2. Readjust tests in cpus-intel.ll


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151696/new/

https://reviews.llvm.org/D151696

Files:
  clang/lib/Basic/Targets/X86.cpp
  clang/lib/Basic/Targets/X86.h
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/test/CodeGen/attr-cpuspecific-avx-abi.c
  clang/test/CodeGen/attr-cpuspecific.c
  llvm/include/llvm/TargetParser/X86TargetParser.def
  llvm/include/llvm/TargetParser/X86TargetParser.h
  llvm/lib/Target/X86/X86.td
  llvm/lib/TargetParser/X86TargetParser.cpp
  llvm/test/CodeGen/X86/cpus-intel.ll

Index: llvm/test/CodeGen/X86/cpus-intel.ll
===
--- llvm/test/CodeGen/X86/cpus-intel.ll
+++ llvm/test/CodeGen/X86/cpus-intel.ll
@@ -5,17 +5,15 @@
 ; RUN: llc < %s -o /dev/null -mtriple=i686-unknown-unknown -mcpu=i486 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty
 ; RUN: llc < %s -o /dev/null -mtriple=i686-unknown-unknown -mcpu=i586 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty
 ; RUN: llc < %s -o /dev/null -mtriple=i686-unknown-unknown -mcpu=pentium 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty
-; RUN: llc < %s -o /dev/null -mtriple=i686-unknown-unknown -mcpu=pentium-mmx 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty
+; RUN: llc < %s -o /dev/null -mtriple=i686-unknown-unknown -mcpu=pentium-mmx -mcpu=pentium_mmx 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty
 ; RUN: llc < %s -o /dev/null -mtriple=i686-unknown-unknown -mcpu=i686 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty
-; RUN: llc < %s -o /dev/null -mtriple=i686-unknown-unknown -mcpu=pentiumpro 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty
-; RUN: llc < %s -o /dev/null -mtriple=i686-unknown-unknown -mcpu=pentium2 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty
-; RUN: llc < %s -o /dev/null -mtriple=i686-unknown-unknown -mcpu=pentium3 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty
-; RUN: llc < %s -o /dev/null -mtriple=i686-unknown-unknown -mcpu=pentium3m 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty
-; RUN: llc < %s -o /dev/null -mtriple=i686-unknown-unknown -mcpu=pentium-m 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty
-; RUN: llc < %s -o /dev/null -mtriple=i686-unknown-unknown -mcpu=pentium4 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty
-; RUN: llc < %s -o /dev/null -mtriple=i686-unknown-unknown -mcpu=pentium4m 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty
+; RUN: llc < %s -o /dev/null -mtriple=i686-unknown-unknown -mcpu=pentiumpro -mcpu=pentium_pro 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty
+; RUN: llc < %s -o /dev/null -mtriple=i686-unknown-unknown -mcpu=pentium2 -mcpu=pentium_ii 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty
+; RUN: llc < %s -o /dev/null -mtriple=i686-unknown-unknown -mcpu=pentium3 -mcpu=pentium3m -mcpu=pentium_iii -mcpu=pentium_iii_no_xmm_regs 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty
+; RUN: llc < %s -o /dev/null -mtriple=i686-unknown-unknown -mcpu=pentium-m -mcpu=pentium_m 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty
+; RUN: llc < %s -o /dev/null -mtriple=i686-unknown-unknown -mcpu=pentium4 -mcpu=pentium4m -mcpu=pentium_4 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty
 ; RUN: llc < %s -o /dev/null -mtriple=i686-unknown-unknown -mcpu=yonah 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty
-; RUN: llc < %s -o /dev/null -mtriple=i686-unknown-unknown -mcpu=prescott 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty
+; RUN: llc < %s -o /dev/null -mtriple=i686-unknown-unknown -mcpu=prescott -mcpu=pentium_4_sse3 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty
 ; RUN: llc < %s -o /dev/null -mtriple=i686-unknown-unknown -mcpu=lakemont 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty
 ; RUN: llc < %s -o /dev/null -mtriple=i686-unknown-unknown -mcpu=raptorlake 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty
 ; RUN: llc < %s -o /dev/null -mtriple=i686-unknown-unknown -mcpu=meteorlake 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty
@@ -25,44 +23,39 @@
 ; RUN: llc < %s -o /dev/null -mtriple=i686-unknown-unknown -mcpu=emeraldrapids 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty
 
 ; RUN: llc < %s -o /dev/null -mtriple=x86_64-unknown-unknown -mcpu=nocona 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty
-; RUN: llc < %s -o /dev/null -mtriple=x86_64-unknown-unknown -mcpu=core2 2>&1 | FileCheck %s --check-prefix=CHECK-NO-ERROR --allow-empty
-; RUN: llc < %s -o /dev/null -mtriple=x86_64-unknown-unknown -mcpu=penryn 2>&1 | FileCheck %s -

[clang] 985dace - [AIX][tests] Temporarily disable test index-with-module.m

2023-06-15 Thread Jake Egan via cfe-commits

Author: Jake Egan
Date: 2023-06-16T01:24:19-04:00
New Revision: 985daceac9cbe4d08a3f018fec47cfc371a9f60b

URL: 
https://github.com/llvm/llvm-project/commit/985daceac9cbe4d08a3f018fec47cfc371a9f60b
DIFF: 
https://github.com/llvm/llvm-project/commit/985daceac9cbe4d08a3f018fec47cfc371a9f60b.diff

LOG: [AIX][tests] Temporarily disable test index-with-module.m

This test is failing on AIX due to patch D151938. Disable it for now to get the 
bot green while we investigate.

Added: 


Modified: 
clang/test/Index/Core/index-with-module.m

Removed: 




diff  --git a/clang/test/Index/Core/index-with-module.m 
b/clang/test/Index/Core/index-with-module.m
index b116768fdb557..5258e64c1941e 100644
--- a/clang/test/Index/Core/index-with-module.m
+++ b/clang/test/Index/Core/index-with-module.m
@@ -1,3 +1,4 @@
+// XFAIL: target={{.*}}-aix{{.*}}
 // RUN: rm -rf %t.mcp
 // RUN: c-index-test core -print-source-symbols -dump-imported-module-files -- 
%s -I %S/Inputs/module -fmodules -fmodules-cache-path=%t.mcp | FileCheck %s
 



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


[PATCH] D152194: [StaticAnalyzer] Fix nullptr dereference issue found by static analyzer tool

2023-06-15 Thread Soumi Manna via Phabricator via cfe-commits
Manna added a comment.

Thank you @erichkeane and @steakhal for reviews and comments.

In D152194#4402377 , @steakhal wrote:

> Please update the title and the summary of this patch to reflect what it 
> actually achieves.
> We also usually use the `[analyzer]` tag only for changes touching 
> `StaticAnalyzer` stuff.
>
> After these, you can merge the patch.

Yes, i will update the title and summary of this patch before merging the patch.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152194/new/

https://reviews.llvm.org/D152194

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


[PATCH] D152321: [clang] Replace use of Type::getPointerTo() (NFC)

2023-06-15 Thread Sergei Barannikov via Phabricator via cfe-commits
barannikov88 added inline comments.



Comment at: clang/lib/CodeGen/ItaniumCXXABI.cpp:2552-2554
   auto AddrAS = addr ? addr->getType()->getPointerAddressSpace() : 0;
-  auto AddrInt8PtrTy =
-  AddrAS ? CGF.Int8Ty->getPointerTo(AddrAS) : CGF.Int8PtrTy;
+  auto AddrPtrTy =
+AddrAS ? llvm::PointerType::get(CGF.getLLVMContext(), AddrAS) : 
CGF.Int8PtrTy;

barannikov88 wrote:
> I think this can be simplified further to just:
> `llvm::Type *AddrPtrTy = addr->getType();`
> 
I was wrong, `addr` can be null here. Sorry.



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152321/new/

https://reviews.llvm.org/D152321

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


[PATCH] D153033: [CLANG]Fix potential null pointer dereference bugs

2023-06-15 Thread Soumi Manna via Phabricator via cfe-commits
Manna added inline comments.



Comment at: clang/lib/Analysis/ThreadSafety.cpp:505-511
   const unsigned *i = C.lookup(D);
   llvm::errs() << " -> ";
+  if (!i) {
+llvm::errs() << "<>";
+return;
+  }
   dumpVarDefinitionName(*i);

aaronpuchert wrote:
> Can't we just take `I.getData()` instead of doing a lookup? After all we're 
> iterating over the same map.
Thank you @aaronpuchert for review and comment.  

>>Can't we just take I.getData() instead of doing a lookup? After all we're 
>>iterating over the same map.

Makes sense to me! I have updated patch


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153033/new/

https://reviews.llvm.org/D153033

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


[PATCH] D152924: [libLTO][AIX] Respect `-f[no]-integrated-as` on AIX

2023-06-15 Thread ChenZheng via Phabricator via cfe-commits
shchenz added a comment.

Seems passing `-Wl,-bplugin_opt:-no-integrated-as=1` from clang driver does not 
work as expected. Is this expected or by design(We can only use 
-fno-integrated-as but no -Wl,-bplugin_opt:-no-integrated-as=1)?

  clang -flto -Wl,-bplugin_opt:-no-integrated-as=1 *.c -v
-bplugin_opt:-no-integrated-as=1 -bplugin:../lib/libLTO.so 
-bplugin_opt:-mcpu=pwr7 -bplugin_opt:-no-integrated-as=0 ;;; Note the second 
-no-integrated-as=0 pass from clang front-end.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152924/new/

https://reviews.llvm.org/D152924

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


[PATCH] D153033: [CLANG]Fix potential null pointer dereference bugs

2023-06-15 Thread Soumi Manna via Phabricator via cfe-commits
Manna updated this revision to Diff 531976.
Manna retitled this revision from "[NFC][CLANG] Fix potential null pointer 
dereference bugs" to "[CLANG]Fix potential null pointer dereference bugs".
Manna added a comment.
Herald added subscribers: steakhal, martong.

Address review comment and update patch


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153033/new/

https://reviews.llvm.org/D153033

Files:
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/MicrosoftMangle.cpp
  clang/lib/Analysis/ThreadSafety.cpp
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp


Index: clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
===
--- clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
@@ -1204,10 +1204,12 @@
 // FIXME: Add a checker option to turn this uniqueing feature off.
 const ExplodedNode *StreamOpenNode = getAcquisitionSite(Err, LeakSym, C);
 assert(StreamOpenNode && "Could not find place of stream opening.");
-PathDiagnosticLocation LocUsedForUniqueing =
-PathDiagnosticLocation::createBegin(
-StreamOpenNode->getStmtForDiagnostics(), C.getSourceManager(),
-StreamOpenNode->getLocationContext());
+
+PathDiagnosticLocation LocUsedForUniqueing;
+if (const Stmt *StreamStmt = StreamOpenNode->getStmtForDiagnostics())
+   LocUsedForUniqueing = PathDiagnosticLocation::createBegin(
+  StreamStmt, C.getSourceManager(),
+  StreamOpenNode->getLocationContext());
 
 std::unique_ptr R =
 std::make_unique(
Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -4955,7 +4955,8 @@
   };
   // The matrix subscript operator ([][])is considered a single operator.
   // Separating the index expressions by parenthesis is not allowed.
-  if (base->hasPlaceholderType(BuiltinType::IncompleteMatrixIdx) &&
+  if (base && !base->getType().isNull() &&
+  base->hasPlaceholderType(BuiltinType::IncompleteMatrixIdx) &&
   !isa(base)) {
 Diag(base->getExprLoc(), diag::err_matrix_separate_incomplete_index)
 << SourceRange(base->getBeginLoc(), rbLoc);
Index: clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
===
--- clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
+++ clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
@@ -3365,7 +3365,7 @@
   if (getDataSharingMode(CGM) != CGOpenMPRuntimeGPU::Generic)
 return Address::invalid();
 
-  VD = VD->getCanonicalDecl();
+  VD = cast(VD->getCanonicalDecl());
   auto I = FunctionGlobalizedDecls.find(CGF.CurFn);
   if (I == FunctionGlobalizedDecls.end())
 return Address::invalid();
Index: clang/lib/Analysis/ThreadSafety.cpp
===
--- clang/lib/Analysis/ThreadSafety.cpp
+++ clang/lib/Analysis/ThreadSafety.cpp
@@ -502,9 +502,8 @@
 for (Context::iterator I = C.begin(), E = C.end(); I != E; ++I) {
   const NamedDecl *D = I.getKey();
   D->printName(llvm::errs());
-  const unsigned *i = C.lookup(D);
   llvm::errs() << " -> ";
-  dumpVarDefinitionName(*i);
+  dumpVarDefinitionName(I.getData());
   llvm::errs() << "\n";
 }
   }
Index: clang/lib/AST/MicrosoftMangle.cpp
===
--- clang/lib/AST/MicrosoftMangle.cpp
+++ clang/lib/AST/MicrosoftMangle.cpp
@@ -2693,7 +2693,7 @@
 // Copy constructor closure always takes an unqualified reference.
 mangleFunctionArgumentType(getASTContext().getLValueReferenceType(
Proto->getParamType(0)
-   ->getAs()
+   ->castAs()
->getPointeeType(),
/*SpelledAsLValue=*/true),
Range);
Index: clang/lib/AST/ASTContext.cpp
===
--- clang/lib/AST/ASTContext.cpp
+++ clang/lib/AST/ASTContext.cpp
@@ -10030,6 +10030,9 @@
 return false;
 
   ObjCTypeParamList *typeParams = iface->getTypeParamList();
+  if (!typeParams)
+return false;
+
   for (unsigned i = 0, n = lhsArgs.size(); i != n; ++i) {
 if (ctx.hasSameType(lhsArgs[i], rhsArgs[i]))
   continue;


Index: clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
===
--- clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
@@ -1204,10 +1204,12 @@
 // FIXME: Add a checker option to turn this uniqueing feature off.
 const ExplodedNode *StreamOpenNode = getAcquisitionSite(Err, LeakS

[PATCH] D152321: [clang] Replace use of Type::getPointerTo() (NFC)

2023-06-15 Thread Sergei Barannikov via Phabricator via cfe-commits
barannikov88 requested changes to this revision.
barannikov88 added a comment.
This revision now requires changes to proceed.

@JOE1994
Please run the testsuite locally (`ninja check-clang`), there is at least one 
test that crashes.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152321/new/

https://reviews.llvm.org/D152321

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


[PATCH] D143617: [Clang][CMake] Support perf, LBR, and Instrument CLANG_BOLT options

2023-06-15 Thread Amir Ayupov via Phabricator via cfe-commits
Amir added a comment.

Ping @beanz, @phosek


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143617/new/

https://reviews.llvm.org/D143617

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


[PATCH] D151349: [HIP] emit macro `__HIP_NO_IMAGE_SUPPORT`

2023-06-15 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment.

In D151349#4426008 , @jhuber6 wrote:

> I've started seeing these errors when compiling for OpenMP targeting AMDGPU:
>
>   $ clang input.c -fopenmp --offload-arch=gfx1030
>   warning: feature flag '+image-insts' is ignored since the feature is read 
> only [-Winvalid-command-line-argument]
>
> Any suggestions for what might cause this?

That means TargetInfo::initFeatureMap is called with `+image-insts`. I will 
take a look.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151349/new/

https://reviews.llvm.org/D151349

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


[PATCH] D152879: [RISCV] Model vxrm control for vsmul, vssra, vssrl, vnclip, and vnclipu

2023-06-15 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments.



Comment at: clang/include/clang/Basic/riscv_vector.td:2269
+
+IntrinsicTypes = {ResultType, Ops[Offset]->getType(), Ops[Offset + 
1]->getType(),
+  Ops.back()->getType()};

craig.topper wrote:
> I think we if we used `LLVMTruncatedType<0>` in IntrinsicsRISCV.td we 
> wouldn't need to pass to `Ops[Offset]->getType()` here. Which I think makes 
> this code identical to the sadd ManualCodegen?
Oops I mean ExtendedType


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152879/new/

https://reviews.llvm.org/D152879

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


[PATCH] D152879: [RISCV] Model vxrm control for vsmul, vssra, vssrl, vnclip, and vnclipu

2023-06-15 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments.



Comment at: clang/include/clang/Basic/riscv_vector.td:2269
+
+IntrinsicTypes = {ResultType, Ops[Offset]->getType(), Ops[Offset + 
1]->getType(),
+  Ops.back()->getType()};

I think we if we used `LLVMTruncatedType<0>` in IntrinsicsRISCV.td we wouldn't 
need to pass to `Ops[Offset]->getType()` here. Which I think makes this code 
identical to the sadd ManualCodegen?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152879/new/

https://reviews.llvm.org/D152879

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


[PATCH] D152879: [RISCV] Model vxrm control for vsmul, vssra, vssrl, vnclip, and vnclipu

2023-06-15 Thread Yueh-Ting (eop) Chen via Phabricator via cfe-commits
eopXD added inline comments.



Comment at: llvm/include/llvm/IR/IntrinsicsRISCV.td:697
+: DefaultAttrsIntrinsic<[llvm_anyvector_ty],
+[LLVMMatchType<0>, llvm_anyvector_ty, llvm_any_ty,
+ LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>, 
llvm_anyint_ty,

craig.topper wrote:
> Something I just noticed today. I think we can use `LLVMExtendedType<0>` 
> instead of llvm_any_vector_ty for the second input operand to make it 
> automatically 2x the element width of the output. Does that simplify the 
> frontend much if we don't need to use an extra IntrinsicType? It would be a 
> separate patch of course if we did it.
This won't affect the front-end. C intrinsics are directly lowered into LLVM 
intrinsics here.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152879/new/

https://reviews.llvm.org/D152879

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


[PATCH] D152879: [RISCV] Model vxrm control for vsmul, vssra, vssrl, vnclip, and vnclipu

2023-06-15 Thread Craig Topper via Phabricator via cfe-commits
craig.topper accepted this revision.
craig.topper added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152879/new/

https://reviews.llvm.org/D152879

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


[PATCH] D152879: [RISCV] Model vxrm control for vsmul, vssra, vssrl, vnclip, and vnclipu

2023-06-15 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments.



Comment at: llvm/include/llvm/IR/IntrinsicsRISCV.td:697
+: DefaultAttrsIntrinsic<[llvm_anyvector_ty],
+[LLVMMatchType<0>, llvm_anyvector_ty, llvm_any_ty,
+ LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>, 
llvm_anyint_ty,

Something I just noticed today. I think we can use `LLVMExtendedType<0>` 
instead of llvm_any_vector_ty for the second input operand to make it 
automatically 2x the element width of the output. Does that simplify the 
frontend much if we don't need to use an extra IntrinsicType? It would be a 
separate patch of course if we did it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152879/new/

https://reviews.llvm.org/D152879

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


[PATCH] D152889: [2/2][RISCV] Model vxrm control for vsadd, vsaddu, vssub, and vssubu

2023-06-15 Thread Yueh-Ting (eop) Chen via Phabricator via cfe-commits
eopXD abandoned this revision.
eopXD added a comment.

Dropping the revision because no change in vsadd(u)/vssub(u) is needed since 
the computation does not consider rounding mode.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152889/new/

https://reviews.llvm.org/D152889

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


[PATCH] D153038: [Clang] Fixes a diagnostic typo.

2023-06-15 Thread Chuanqi Xu via Phabricator via cfe-commits
ChuanqiXu accepted this revision.
ChuanqiXu added a comment.
This revision is now accepted and ready to land.

Thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153038/new/

https://reviews.llvm.org/D153038

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


[PATCH] D152879: [1/2][RISCV] Model vxrm control for vsmul, vssra, vssrl, vnclip, and vnclipu

2023-06-15 Thread Yueh-Ting (eop) Chen via Phabricator via cfe-commits
eopXD updated this revision to Diff 531966.
eopXD added a comment.

Fix sema checking test case.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152879/new/

https://reviews.llvm.org/D152879

Files:
  clang/include/clang/Basic/riscv_vector.td
  clang/lib/Sema/SemaChecking.cpp
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vnclip.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vnclipu.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsmul.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssra.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssrl.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vnclip.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vnclipu.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsmul.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssra.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssrl.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/non-overloaded/vnclip.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/non-overloaded/vnclipu.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/non-overloaded/vsmul.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/non-overloaded/vssra.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/non-overloaded/vssrl.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/overloaded/vnclip.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/overloaded/vnclipu.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/overloaded/vsmul.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/overloaded/vssra.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/overloaded/vssrl.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-handcrafted/vnclip-out-of-range.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-handcrafted/vnclipu-out-of-range.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-handcrafted/vsmul-eew64-overloaded.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-handcrafted/vsmul-eew64.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-handcrafted/vsmul-out-of-range.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-handcrafted/vssra-out-of-range.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-handcrafted/vssrl-out-of-range.c
  llvm/include/llvm/IR/IntrinsicsRISCV.td
  llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
  llvm/test/CodeGen/RISCV/rvv/masked-tama.ll
  llvm/test/CodeGen/RISCV/rvv/masked-tamu.ll
  llvm/test/CodeGen/RISCV/rvv/masked-tuma.ll
  llvm/test/CodeGen/RISCV/rvv/masked-tumu.ll
  llvm/test/CodeGen/RISCV/rvv/mutate-prior-vsetvli-avl.ll
  llvm/test/CodeGen/RISCV/rvv/unmasked-tu.ll
  llvm/test/CodeGen/RISCV/rvv/vnclip.ll
  llvm/test/CodeGen/RISCV/rvv/vnclipu.ll
  llvm/test/CodeGen/RISCV/rvv/vsmul-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vsmul-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vssra-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vssra-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vssrl-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vssrl-rv64.ll

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


[PATCH] D152879: [1/2][RISCV] Model vxrm control for vsmul, vssra, vssrl, vnclip, and vnclipu

2023-06-15 Thread Yueh-Ting (eop) Chen via Phabricator via cfe-commits
eopXD updated this revision to Diff 531963.
eopXD added a comment.

Add semanic check to the vxrm parameter.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152879/new/

https://reviews.llvm.org/D152879

Files:
  clang/include/clang/Basic/riscv_vector.td
  clang/lib/Sema/SemaChecking.cpp
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vnclip.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vnclipu.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsmul.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssra.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssrl.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vnclip.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vnclipu.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsmul.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssra.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssrl.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/non-overloaded/vnclip.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/non-overloaded/vnclipu.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/non-overloaded/vsmul.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/non-overloaded/vssra.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/non-overloaded/vssrl.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/overloaded/vnclip.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/overloaded/vnclipu.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/overloaded/vsmul.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/overloaded/vssra.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/overloaded/vssrl.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-handcrafted/vnclip-out-of-range.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-handcrafted/vnclipu-out-of-range.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-handcrafted/vsmul-eew64-overloaded.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-handcrafted/vsmul-eew64.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-handcrafted/vsmul-out-of-range.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-handcrafted/vssra-out-of-range.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-handcrafted/vssrl-out-of-range.c
  llvm/include/llvm/IR/IntrinsicsRISCV.td
  llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
  llvm/test/CodeGen/RISCV/rvv/masked-tama.ll
  llvm/test/CodeGen/RISCV/rvv/masked-tamu.ll
  llvm/test/CodeGen/RISCV/rvv/masked-tuma.ll
  llvm/test/CodeGen/RISCV/rvv/masked-tumu.ll
  llvm/test/CodeGen/RISCV/rvv/mutate-prior-vsetvli-avl.ll
  llvm/test/CodeGen/RISCV/rvv/unmasked-tu.ll
  llvm/test/CodeGen/RISCV/rvv/vnclip.ll
  llvm/test/CodeGen/RISCV/rvv/vnclipu.ll
  llvm/test/CodeGen/RISCV/rvv/vsmul-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vsmul-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vssra-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vssra-rv64.ll
  llvm/test/CodeGen/RISCV/rvv/vssrl-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vssrl-rv64.ll

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


[PATCH] D153092: [Clang][CodeGen]`vtable`, `typeinfo` et al. are globals

2023-06-15 Thread Alex Voicu via Phabricator via cfe-commits
AlexVlx created this revision.
AlexVlx added reviewers: rjmccall, efriedma, yaxunl.
Herald added subscribers: arichardson, tpr.
Herald added a project: All.
AlexVlx requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

All data structures and values associated with handling virtual functions / 
inheritance, as well as RTTI, are globals and thus can only reside in the 
`global` address space. This was not taken fully taken into account because for 
most targets, `global` & `generic` appear to coincide. However, on targets 
where `global` & `generic` `AS`es differ (e.g. AMDGPU), this was problematic, 
since it led to the generation of invalid `bitcast`s (which would trigger 
`assert`s in Debug) and less than optimal code. This patch does two things:

- ensures that `vtable`s, `vptr`s, `vtt`s, `typeinfo` are generated in the 
right AS, and populated accordingly;
- removes a bunch of `bitcast`s which look like left-overs from the typed ptr 
era.

This is a bit more noisy than I'd have liked, but functionality is somewhat 
spread out. There's one bit of less than ideal code, stemming from the fact 
that functions are in the `generic` AS, and thus it's necessary to insert a 
`constexpr` cast from `generic` to `global` when populating the `vtable`. 
Adjusting appears disruptive enough to prefer to do it separately (unless I 
missed something obvious).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D153092

Files:
  clang/lib/CodeGen/CGVTT.cpp
  clang/lib/CodeGen/CGVTables.cpp
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/CodeGen/ItaniumCXXABI.cpp
  clang/test/CodeGenCXX/vtable-align-address-space.cpp
  clang/test/CodeGenCXX/vtable-assume-load-address-space.cpp
  clang/test/CodeGenCXX/vtable-consteval-address-space.cpp
  clang/test/CodeGenCXX/vtable-constexpr-address-space.cpp
  clang/test/CodeGenCXX/vtable-key-function-address-space.cpp
  clang/test/CodeGenCXX/vtable-layout-extreme-address-space.cpp
  clang/test/CodeGenCXX/vtable-linkage-address-space.cpp
  clang/test/CodeGenCXX/vtable-pointer-initialization-address-space.cpp
  clang/test/CodeGenCXX/vtt-address-space.cpp
  clang/test/CodeGenCXX/vtt-layout-address-space.cpp
  clang/test/Headers/hip-header.hip

Index: clang/test/Headers/hip-header.hip
===
--- clang/test/Headers/hip-header.hip
+++ clang/test/Headers/hip-header.hip
@@ -60,9 +60,8 @@
 __device__ void test_vf() {
 derived d;
 }
-// CHECK: @_ZTV7derived = linkonce_odr unnamed_addr addrspace(1) constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr null, ptr @_ZN7derived2pvEv, ptr @__cxa_deleted_virtual] }, comdat, align 8
-// CHECK: @_ZTV4base = linkonce_odr unnamed_addr addrspace(1) constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr null, ptr @__cxa_pure_virtual, ptr @__cxa_deleted_virtual] }, comdat, align 8
-
+// CHECK: @_ZTV7derived = linkonce_odr unnamed_addr addrspace(1) constant { [4 x ptr addrspace(1)] } { [4 x ptr addrspace(1)] [ptr addrspace(1) null, ptr addrspace(1) null, ptr addrspace(1) addrspacecast (ptr @_ZN7derived2pvEv to ptr addrspace(1)), ptr addrspace(1) addrspacecast (ptr @__cxa_deleted_virtual to ptr addrspace(1))] }, comdat, align 8
+// CHECK: @_ZTV4base = linkonce_odr unnamed_addr addrspace(1) constant { [4 x ptr addrspace(1)] } { [4 x ptr addrspace(1)] [ptr addrspace(1) null, ptr addrspace(1) null, ptr addrspace(1) addrspacecast (ptr @__cxa_pure_virtual to ptr addrspace(1)), ptr addrspace(1) addrspacecast (ptr @__cxa_deleted_virtual to ptr addrspace(1))] }, comdat, align 8
 // CHECK: define{{.*}}void @__cxa_pure_virtual()
 // CHECK: define{{.*}}void @__cxa_deleted_virtual()
 
Index: clang/test/CodeGenCXX/vtt-layout-address-space.cpp
===
--- /dev/null
+++ clang/test/CodeGenCXX/vtt-layout-address-space.cpp
@@ -0,0 +1,89 @@
+// RUN: %clang_cc1 %s -triple=amdgcn-amd-amdhsa -std=c++11 -emit-llvm -o - | FileCheck %s
+
+// Test1::B should just have a single entry in its VTT, which points to the vtable.
+namespace Test1 {
+struct A { };
+
+struct B : virtual A {
+  virtual void f();
+};
+
+void B::f() { }
+}
+
+// Check that we don't add a secondary virtual pointer for Test2::A, since Test2::A doesn't have any virtual member functions or bases.
+namespace Test2 {
+  struct A { };
+
+  struct B : A { virtual void f(); };
+  struct C : virtual B { };
+
+  C c;
+}
+
+// This is the sample from the C++ Itanium ABI, p2.6.2.
+namespace Test3 {
+  class A1 { int i; };
+  class A2 { int i; virtual void f(); };
+  class V1 : public A1, public A2 { int i; };
+  class B1 { int i; };
+  class B2 { int i; };
+  class V2 : public B1, public B2, public virtual V1 { int i; };
+  class V3 {virtual void g(); };
+  class C1 : public virtual V1 { int i; };
+  class C2 : public virtual V3, virtual V2 { int i; };
+  class X1 { int i; };
+  class C3 : public X1 { int i; };
+  class D : public C1, public C2, pub

[PATCH] D134678: [Clang][AArch64][SME] Add intrinsics for ZA array load/store (LDR/STR)

2023-06-15 Thread Bryan Chan via Phabricator via cfe-commits
bryanpkc updated this revision to Diff 531953.
bryanpkc added a comment.

Also added SME attributes to the tests.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134678/new/

https://reviews.llvm.org/D134678

Files:
  clang/include/clang/Basic/arm_sme.td
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_ldr.c
  clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_str.c
  clang/test/Sema/aarch64-sme-intrinsics/acle_sme_imm.cpp

Index: clang/test/Sema/aarch64-sme-intrinsics/acle_sme_imm.cpp
===
--- clang/test/Sema/aarch64-sme-intrinsics/acle_sme_imm.cpp
+++ clang/test/Sema/aarch64-sme-intrinsics/acle_sme_imm.cpp
@@ -187,6 +187,11 @@
   // expected-error@+1 {{argument value 16 is outside the valid range [0, 15]}}
   SVE_ACLE_FUNC(svst1_ver_vnum_za8,,,)(0, -1, 16, pg, ptr, 1);
 
+  // expected-error@+1 {{argument value 16 is outside the valid range [0, 15]}}
+  SVE_ACLE_FUNC(svldr_vnum_za,,,)(-1, 16, ptr);
+  // expected-error@+1 {{argument value 18446744073709551615 is outside the valid range [0, 15]}}
+  SVE_ACLE_FUNC(svstr_vnum_za,,,)(-1, -1, ptr);
+
   // expected-error@+1 {{argument value 18446744073709551615 is outside the valid range [0, 15]}}
   SVE_ACLE_FUNC(svread_hor_za128, _s8, _m,)(svundef_s8(), pg, -1, -1, 0);
   // expected-error@+1 {{argument value 16 is outside the valid range [0, 15]}}
@@ -224,6 +229,9 @@
   SVE_ACLE_FUNC(svst1_hor_vnum_za32,,,)(u64, u64, 0, pg, ptr, u64); // expected-error {{argument to 'svst1_hor_vnum_za32' must be a constant integer}}
   SVE_ACLE_FUNC(svst1_ver_vnum_za64,,,)(0, u64, u64, pg, ptr, u64); // expected-error {{argument to 'svst1_ver_vnum_za64' must be a constant integer}}
 
+  SVE_ACLE_FUNC(svldr_vnum_za,,,)(u64, u64, ptr); // expected-error {{argument to 'svldr_vnum_za' must be a constant integer}}
+  SVE_ACLE_FUNC(svstr_vnum_za,,,)(u64, u64, ptr); // expected-error {{argument to 'svstr_vnum_za' must be a constant integer}}
+
   SVE_ACLE_FUNC(svread_hor_za8, _s8, _m,)(svundef_s8(), pg, 0, u64, u64); // expected-error-re {{argument to 'svread_hor_za8{{.*}}_m' must be a constant integer}}
   SVE_ACLE_FUNC(svread_ver_za16, _s16, _m,)(svundef_s16(), pg, u64, u64, 0);  // expected-error-re {{argument to 'svread_ver_za16{{.*}}_m' must be a constant integer}}
   SVE_ACLE_FUNC(svwrite_hor_za32, _s32, _m,)(0, u64, u64, pg, svundef_s32()); // expected-error-re {{argument to 'svwrite_hor_za32{{.*}}_m' must be a constant integer}}
Index: clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_str.c
===
--- /dev/null
+++ clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_str.c
@@ -0,0 +1,35 @@
+// REQUIRES: aarch64-registered-target
+// RUN: %clang_cc1 -DDISABLE_SME_ATTRIBUTES -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C
+// RUN: %clang_cc1 -DDISABLE_SME_ATTRIBUTES -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX
+// RUN: %clang_cc1 -DDISABLE_SME_ATTRIBUTES -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -o /dev/null %s
+
+#include 
+
+#ifdef DISABLE_SME_ATTRIBUTES
+#define ARM_SHARED_ZA_ATTR
+#else
+#define ARM_SHARED_ZA_ATTR __attribute__((arm_shared_za))
+#endif
+
+// CHECK-C-LABEL: @test_svstr_vnum_za(
+// CHECK-CXX-LABEL: @_Z18test_svstr_vnum_zajPv(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:tail call void @llvm.aarch64.sme.str(i32 [[SLICE_BASE:%.*]], ptr [[PTR:%.*]])
+// CHECK-NEXT:ret void
+//
+ARM_SHARED_ZA_ATTR void test_svstr_vnum_za(uint32_t slice_base, void *ptr) {
+  svstr_vnum_za(slice_base, 0, ptr);
+}
+
+// CHECK-C-LABEL: @test_svstr_vnum_za_1(
+// CHECK-CXX-LABEL: @_Z20test_svstr_vnum_za_1jPv(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[VSCALE:%.*]] = tail call i64 @llvm.vscale.i64()
+// CHECK-NEXT:[[MULVL:%.*]] = mul nuw nsw i64 [[VSCALE]], 240
+// CHECK-NEXT:[[TMP0:%.*]] = getelementptr i8, ptr [[PTR:%.*]], i64 [[MULVL]]
+// CHECK-NEXT:tail call void @llvm.aarch64.sme.str(i32 [[SLICE_BASE:%.*]], ptr [[TMP0]])
+// CHECK-NEXT:ret void
+//
+ARM_SHARED_ZA_ATTR void test_svstr_vnum_za_1(uint32_t slice_base, void *ptr) {
+  svstr_vnum_za(slice_base, 15, ptr);
+}
Index: clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_ldr.c
===
--- /dev/null
+++ clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_ldr.c
@@ -0,0 +1,35 @@
+// REQUIRES: aarch64-registered-target
+// RUN: %clang_cc1 -DDISABLE_SME_ATTRIBUTES -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C
+// RUN: %clang_cc1 -DDISABLE

[PATCH] D134678: [Clang][AArch64][SME] Add intrinsics for ZA array load/store (LDR/STR)

2023-06-15 Thread Bryan Chan via Phabricator via cfe-commits
bryanpkc updated this revision to Diff 531949.
bryanpkc added a comment.

Instead of defining new type flags, `EmitAArch64SMEBuiltinExpr` is updated to 
switch on `BuiltinID`, as suggested by @sdesmalen.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134678/new/

https://reviews.llvm.org/D134678

Files:
  clang/include/clang/Basic/arm_sme.td
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_ldr.c
  clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_str.c
  clang/test/Sema/aarch64-sme-intrinsics/acle_sme_imm.cpp

Index: clang/test/Sema/aarch64-sme-intrinsics/acle_sme_imm.cpp
===
--- clang/test/Sema/aarch64-sme-intrinsics/acle_sme_imm.cpp
+++ clang/test/Sema/aarch64-sme-intrinsics/acle_sme_imm.cpp
@@ -187,6 +187,11 @@
   // expected-error@+1 {{argument value 16 is outside the valid range [0, 15]}}
   SVE_ACLE_FUNC(svst1_ver_vnum_za8,,,)(0, -1, 16, pg, ptr, 1);
 
+  // expected-error@+1 {{argument value 16 is outside the valid range [0, 15]}}
+  SVE_ACLE_FUNC(svldr_vnum_za,,,)(-1, 16, ptr);
+  // expected-error@+1 {{argument value 18446744073709551615 is outside the valid range [0, 15]}}
+  SVE_ACLE_FUNC(svstr_vnum_za,,,)(-1, -1, ptr);
+
   // expected-error@+1 {{argument value 18446744073709551615 is outside the valid range [0, 15]}}
   SVE_ACLE_FUNC(svread_hor_za128, _s8, _m,)(svundef_s8(), pg, -1, -1, 0);
   // expected-error@+1 {{argument value 16 is outside the valid range [0, 15]}}
@@ -224,6 +229,9 @@
   SVE_ACLE_FUNC(svst1_hor_vnum_za32,,,)(u64, u64, 0, pg, ptr, u64); // expected-error {{argument to 'svst1_hor_vnum_za32' must be a constant integer}}
   SVE_ACLE_FUNC(svst1_ver_vnum_za64,,,)(0, u64, u64, pg, ptr, u64); // expected-error {{argument to 'svst1_ver_vnum_za64' must be a constant integer}}
 
+  SVE_ACLE_FUNC(svldr_vnum_za,,,)(u64, u64, ptr); // expected-error {{argument to 'svldr_vnum_za' must be a constant integer}}
+  SVE_ACLE_FUNC(svstr_vnum_za,,,)(u64, u64, ptr); // expected-error {{argument to 'svstr_vnum_za' must be a constant integer}}
+
   SVE_ACLE_FUNC(svread_hor_za8, _s8, _m,)(svundef_s8(), pg, 0, u64, u64); // expected-error-re {{argument to 'svread_hor_za8{{.*}}_m' must be a constant integer}}
   SVE_ACLE_FUNC(svread_ver_za16, _s16, _m,)(svundef_s16(), pg, u64, u64, 0);  // expected-error-re {{argument to 'svread_ver_za16{{.*}}_m' must be a constant integer}}
   SVE_ACLE_FUNC(svwrite_hor_za32, _s32, _m,)(0, u64, u64, pg, svundef_s32()); // expected-error-re {{argument to 'svwrite_hor_za32{{.*}}_m' must be a constant integer}}
Index: clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_str.c
===
--- /dev/null
+++ clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_str.c
@@ -0,0 +1,29 @@
+// REQUIRES: aarch64-registered-target
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -o /dev/null %s
+
+#include 
+
+// CHECK-C-LABEL: @test_svstr_vnum_za(
+// CHECK-CXX-LABEL: @_Z18test_svstr_vnum_zajPv(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:tail call void @llvm.aarch64.sme.str(i32 [[SLICE_BASE:%.*]], ptr [[PTR:%.*]])
+// CHECK-NEXT:ret void
+//
+void test_svstr_vnum_za(uint32_t slice_base, void *ptr) {
+  svstr_vnum_za(slice_base, 0, ptr);
+}
+
+// CHECK-C-LABEL: @test_svstr_vnum_za_1(
+// CHECK-CXX-LABEL: @_Z20test_svstr_vnum_za_1jPv(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[VSCALE:%.*]] = tail call i64 @llvm.vscale.i64()
+// CHECK-NEXT:[[MULVL:%.*]] = mul nuw nsw i64 [[VSCALE]], 240
+// CHECK-NEXT:[[TMP0:%.*]] = getelementptr i8, ptr [[PTR:%.*]], i64 [[MULVL]]
+// CHECK-NEXT:tail call void @llvm.aarch64.sme.str(i32 [[SLICE_BASE:%.*]], ptr [[TMP0]])
+// CHECK-NEXT:ret void
+//
+void test_svstr_vnum_za_1(uint32_t slice_base, void *ptr) {
+  svstr_vnum_za(slice_base, 15, ptr);
+}
Index: clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_ldr.c
===
--- /dev/null
+++ clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_ldr.c
@@ -0,0 +1,29 @@
+// REQUIRES: aarch64-registered-target
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX
+// RUN: %clang_cc1 -triple aar

[PATCH] D145848: [Driver] Correct -f(no-)xray-function-index behavior

2023-06-15 Thread Oleksii Lozovskyi via Phabricator via cfe-commits
ilammy abandoned this revision.
ilammy added a comment.

@MaskRay, thanks!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145848/new/

https://reviews.llvm.org/D145848

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


[PATCH] D137872: Implement lambdas with inalloca parameters by forwarding to function without inalloca calling convention.

2023-06-15 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added inline comments.



Comment at: clang/lib/CodeGen/CodeGenFunction.cpp:1470
+->getLambdaStaticInvoker()) &&
+ !Fn->getName().contains("__impl")) {
+// If emitting a lambda with static invoker on X86 Windows, change

I'm not sure `__impl` is unique enough that user code will never use it.  (I 
mean, it's reserved, but we don't actually forbid using it.)

Can we use the isDelegateCall() bit?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137872/new/

https://reviews.llvm.org/D137872

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


[PATCH] D153033: [NFC][CLANG] Fix potential null pointer dereference bugs

2023-06-15 Thread Aaron Puchert via Phabricator via cfe-commits
aaronpuchert added inline comments.



Comment at: clang/lib/Analysis/ThreadSafety.cpp:505-511
   const unsigned *i = C.lookup(D);
   llvm::errs() << " -> ";
+  if (!i) {
+llvm::errs() << "<>";
+return;
+  }
   dumpVarDefinitionName(*i);

Can't we just take `I.getData()` instead of doing a lookup? After all we're 
iterating over the same map.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153033/new/

https://reviews.llvm.org/D153033

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


[clang] 0cbbfb8 - [CGCall] Prune ArgStruct [-Wunused-variable]

2023-06-15 Thread NAKAMURA Takumi via cfe-commits

Author: NAKAMURA Takumi
Date: 2023-06-16T08:00:57+09:00
New Revision: 0cbbfb8c2e03275e2f67e4f953693601785069a4

URL: 
https://github.com/llvm/llvm-project/commit/0cbbfb8c2e03275e2f67e4f953693601785069a4
DIFF: 
https://github.com/llvm/llvm-project/commit/0cbbfb8c2e03275e2f67e4f953693601785069a4.diff

LOG: [CGCall] Prune ArgStruct [-Wunused-variable]

It has been unused since b92ccc355acb

Added: 


Modified: 
clang/lib/CodeGen/CGCall.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 71268d9abcbda..fc77566c790c1 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -1666,12 +1666,9 @@ CodeGenTypes::GetFunctionType(const CGFunctionInfo &FI) {
   }
 
   // Add type for inalloca argument.
-  if (IRFunctionArgs.hasInallocaArg()) {
-auto ArgStruct = FI.getArgStruct();
-assert(ArgStruct);
+  if (IRFunctionArgs.hasInallocaArg())
 ArgTypes[IRFunctionArgs.getInallocaArgNo()] =
 llvm::PointerType::getUnqual(getLLVMContext());
-  }
 
   // Add in all of the required arguments.
   unsigned ArgNo = 0;



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


[PATCH] D152570: [clang] Apply -fmacro-prefix-map to anonymous tags in template arguments

2023-06-15 Thread Dan McGregor via Phabricator via cfe-commits
dankm updated this revision to Diff 531931.
dankm added a comment.

Update release notes


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152570/new/

https://reviews.llvm.org/D152570

Files:
  clang/docs/ReleaseNotes.rst
  clang/lib/AST/Expr.cpp
  clang/test/CodeGenCXX/macro-prefix-map-lambda.cpp


Index: clang/test/CodeGenCXX/macro-prefix-map-lambda.cpp
===
--- /dev/null
+++ clang/test/CodeGenCXX/macro-prefix-map-lambda.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -triple %itanium_abi_triple 
-fmacro-prefix-map=%p=./UNLIKELY_PATH/empty -S %s -emit-llvm -o - | FileCheck %s
+
+template
+auto lambdatest(f&& cb) {
+  const char *s = __PRETTY_FUNCTION__;
+  return s;
+}
+
+int main() {
+  auto *s = lambdatest([](){});
+// CHECK: @"__PRETTY_FUNCTION__._Z10lambdatestIZ4mainE3$_0EDaOT_" = private 
unnamed_addr constant [{{[0-9]+}} x i8] c"auto lambdatest(f &&) [f = (lambda at 
./UNLIKELY_PATH/empty{{/|}}{{.*}}.cpp:[[#@LINE-1]]:24)]\00", align 1
+
+  return 0;
+}
Index: clang/lib/AST/Expr.cpp
===
--- clang/lib/AST/Expr.cpp
+++ clang/lib/AST/Expr.cpp
@@ -786,7 +786,21 @@
 Out << "static ";
 }
 
+class PrettyCallbacks final : public PrintingCallbacks {
+public:
+  PrettyCallbacks(const LangOptions &LO) : LO(LO) {}
+  std::string remapPath(StringRef Path) const override {
+SmallString<128> p(Path);
+LO.remapPathPrefix(p);
+return std::string(p);
+  }
+
+private:
+  const LangOptions &LO;
+};
 PrintingPolicy Policy(Context.getLangOpts());
+PrettyCallbacks PrettyCB(Context.getLangOpts());
+Policy.Callbacks = &PrettyCB;
 std::string Proto;
 llvm::raw_string_ostream POut(Proto);
 
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -511,6 +511,8 @@
 - CallExpr built for C error-recovery now is always type-dependent. Fixes a
   crash when we encounter a unresolved TypoExpr during diagnostic emission.
   (`#50244 _`).
+- Apply ``-fmacro-prefix-map`` to anonymous tags in template arguments
+  (`#63219 `_)
 
 Bug Fixes to Compiler Builtins
 ^^


Index: clang/test/CodeGenCXX/macro-prefix-map-lambda.cpp
===
--- /dev/null
+++ clang/test/CodeGenCXX/macro-prefix-map-lambda.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -triple %itanium_abi_triple -fmacro-prefix-map=%p=./UNLIKELY_PATH/empty -S %s -emit-llvm -o - | FileCheck %s
+
+template
+auto lambdatest(f&& cb) {
+  const char *s = __PRETTY_FUNCTION__;
+  return s;
+}
+
+int main() {
+  auto *s = lambdatest([](){});
+// CHECK: @"__PRETTY_FUNCTION__._Z10lambdatestIZ4mainE3$_0EDaOT_" = private unnamed_addr constant [{{[0-9]+}} x i8] c"auto lambdatest(f &&) [f = (lambda at ./UNLIKELY_PATH/empty{{/|}}{{.*}}.cpp:[[#@LINE-1]]:24)]\00", align 1
+
+  return 0;
+}
Index: clang/lib/AST/Expr.cpp
===
--- clang/lib/AST/Expr.cpp
+++ clang/lib/AST/Expr.cpp
@@ -786,7 +786,21 @@
 Out << "static ";
 }
 
+class PrettyCallbacks final : public PrintingCallbacks {
+public:
+  PrettyCallbacks(const LangOptions &LO) : LO(LO) {}
+  std::string remapPath(StringRef Path) const override {
+SmallString<128> p(Path);
+LO.remapPathPrefix(p);
+return std::string(p);
+  }
+
+private:
+  const LangOptions &LO;
+};
 PrintingPolicy Policy(Context.getLangOpts());
+PrettyCallbacks PrettyCB(Context.getLangOpts());
+Policy.Callbacks = &PrettyCB;
 std::string Proto;
 llvm::raw_string_ostream POut(Proto);
 
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -511,6 +511,8 @@
 - CallExpr built for C error-recovery now is always type-dependent. Fixes a
   crash when we encounter a unresolved TypoExpr during diagnostic emission.
   (`#50244 _`).
+- Apply ``-fmacro-prefix-map`` to anonymous tags in template arguments
+  (`#63219 `_)
 
 Bug Fixes to Compiler Builtins
 ^^
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D152570: [clang] Apply -fmacro-prefix-map to anonymous tags in template arguments

2023-06-15 Thread Dan McGregor via Phabricator via cfe-commits
dankm added a comment.

Thanks, I'll update the release notes & description right away.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152570/new/

https://reviews.llvm.org/D152570

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


[clang] 06a0ae6 - Reland "[DebugMetadata][DwarfDebug] Fix DWARF emisson of function-local imported entities (3/7)"

2023-06-15 Thread Vladislav Dzhidzhoev via cfe-commits

Author: Vladislav Dzhidzhoev
Date: 2023-06-16T00:49:59+02:00
New Revision: 06a0ae652497513398865d9a1b0cc3f95aa82f54

URL: 
https://github.com/llvm/llvm-project/commit/06a0ae652497513398865d9a1b0cc3f95aa82f54
DIFF: 
https://github.com/llvm/llvm-project/commit/06a0ae652497513398865d9a1b0cc3f95aa82f54.diff

LOG: Reland "[DebugMetadata][DwarfDebug] Fix DWARF emisson of function-local 
imported entities (3/7)"

Got rid of non-determinism in MetadataLoader.cpp.

Authored-by: Kristina Bessonova 

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

Added: 
llvm/test/Bitcode/upgrade-cu-locals.ll
llvm/test/Bitcode/upgrade-cu-locals.ll.bc
llvm/test/DebugInfo/Generic/import-inlined-declaration.ll
llvm/test/DebugInfo/Generic/split-dwarf-local-import.ll
llvm/test/DebugInfo/Generic/split-dwarf-local-import2.ll
llvm/test/DebugInfo/Generic/split-dwarf-local-import3.ll

Modified: 
clang/test/CodeGenCXX/debug-info-namespace.cpp
llvm/include/llvm/IR/DIBuilder.h
llvm/lib/Bitcode/Reader/MetadataLoader.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
llvm/lib/CodeGen/AsmPrinter/DwarfFile.h
llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
llvm/lib/IR/DIBuilder.cpp
llvm/lib/IR/Verifier.cpp
llvm/lib/Linker/IRMover.cpp
llvm/test/Bitcode/DIImportedEntity_backward.ll
llvm/test/Bitcode/DIModule-fortran-external-module.ll
llvm/test/CodeGen/Generic/DbgValueAggregate.ll
llvm/test/DebugInfo/Generic/imported-name-inlined.ll
llvm/test/DebugInfo/Generic/namespace.ll
llvm/test/DebugInfo/Generic/verifier-invalid-disubprogram.ll
llvm/test/DebugInfo/X86/dimodule-external-fortran.ll
llvm/test/DebugInfo/X86/dwarfdump-DIImportedEntity_elements.ll
llvm/test/DebugInfo/X86/fission-inline.ll
llvm/test/DebugInfo/X86/fission-local-import.ll
llvm/test/DebugInfo/X86/fission-no-inline-gsym.ll
llvm/test/DebugInfo/X86/lexical-block-file-inline.ll
llvm/test/DebugInfo/X86/namelist2.ll
llvm/test/DebugInfo/omit-empty.ll
llvm/test/Linker/pr26037.ll
llvm/test/ThinLTO/X86/debuginfo-cu-import.ll

Removed: 




diff  --git a/clang/test/CodeGenCXX/debug-info-namespace.cpp 
b/clang/test/CodeGenCXX/debug-info-namespace.cpp
index be88feda1112f..e3cf6507e1611 100644
--- a/clang/test/CodeGenCXX/debug-info-namespace.cpp
+++ b/clang/test/CodeGenCXX/debug-info-namespace.cpp
@@ -81,44 +81,43 @@ void C::c() {}
 // CHECK: !DINamespace(scope: null)
 // CHECK: [[CU:![0-9]+]] = distinct !DICompileUnit(
 // CHECK-SAME:imports: [[MODULES:![0-9]*]]
-// CHECK: [[MODULES]] = !{[[M1:![0-9]+]], [[M2:![0-9]+]], [[M3:![0-9]+]], 
[[M4:![0-9]+]], [[M5:![0-9]+]], [[M6:![0-9]+]], [[M7:![0-9]+]], [[M8:![0-9]+]], 
[[M9:![0-9]+]], [[M10:![0-9]+]], [[M11:![0-9]+]], [[M12:![0-9]+]], 
[[M13:![0-9]+]], [[M14:![0-9]+]], [[M15:![0-9]+]], [[M16:![0-9]+]], 
[[M17:![0-9]+]]
+// CHECK: [[MODULES]] = !{[[M1:![0-9]+]], [[M2:![0-9]+]], [[M3:![0-9]+]], 
[[M4:![0-9]+]]}
 // CHECK: [[M1]] = !DIImportedEntity(tag: DW_TAG_imported_module, scope: 
[[CTXT]], entity: [[NS]], file: [[FOOCPP]], line: 15)
-
 // CHECK: [[M2]] = !DIImportedEntity(tag: DW_TAG_imported_module, scope: 
[[CU]], entity: [[CTXT]],
 // CHECK: [[M3]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, name: 
"E", scope: [[CU]], entity: [[CTXT]], file: [[FOOCPP]], line: 19)
-// CHECK: [[M4]] = !DIImportedEntity(tag: DW_TAG_imported_module, scope: 
[[LEX2:![0-9]+]], entity: [[NS]], file: [[FOOCPP]], line: 23)
+// CHECK: [[M4]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: 
[[CTXT]], entity: [[I]]
+// CHECK: [[F1:![0-9]+]] = distinct !DISubprogram(name: "f1",{{.*}} line: 4
+// CHECK-SAME:   DISPFlagDefinition
+// CHECK: [[FUNC:![0-9]+]] = distinct !DISubprogram(name: "func",{{.*}} 
DISPFlagDefinition
+// CHECK-SAME: retainedNodes: 
[[FUNC_NODES:![0-9]*]]
+// CHECK: [[FUNC_NODES]] = !{[[M5:![0-9]+]], [[M6:![0-9]+]], [[M7:![0-9]+]], 
[[M8:![0-9]+]], [[M9:![0-9]+]], [[M10:![0-9]+]], [[M11:![0-9]+]], 
[[M12:![0-9]+]], [[M13:![0-9]+]], [[M14:![0-9]+]], [[M15:![0-9]+]], 
[[M16:![0-9]+]], [[M17:![0-9]+]]}
+// CHECK: [[M5]] = !DIImportedEntity(tag: DW_TAG_imported_module, scope: 
[[LEX2:![0-9]+]], entity: [[NS]], file: [[FOOCPP]], line: 23)
 // CHECK: [[LEX2]] = distinct !DILexicalBlock(scope: [[LEX1:![0-9]+]], file: 
[[FOOCPP]],
 // CHECK: [[LEX1]] = distinct !DILexicalBlock(scope: [[FUNC:![0-9]+]], file: 
[[FOOCPP]],
-
-// CHECK: [[FUNC:![0-9]+]] = distinct !DISubprogram(name: "func",{{.*}} 
DISPFlagDefinition
-// CHECK: [[M5]] = !DIImportedEntity(tag: DW_TAG_imported_module, scope: 
[[FUNC]], entity: [[CTXT:![0-9]+]],
-// CHECK: [[M6]] = !DIImportedEntity(tag: DW_TAG_impo

[PATCH] D146777: [clang] Preliminary fat-lto-object support

2023-06-15 Thread Paul Kirth via Phabricator via cfe-commits
paulkirth added inline comments.



Comment at: clang/lib/CodeGen/BackendUtil.cpp:1065
+  if (CodeGenOpts.FatLTO) {
+// Set EnableSplitLTOUnit, since the config above won't
+if (!TheModule->getModuleFlag("EnableSplitLTOUnit"))

tejohnson wrote:
> Can you expand the comment a bit - specifically why it won't end up in the 
> above handling? I assume the Action type is different for FatLTO?
yes, we're not either of the above Action types. I'll expand that description 
to include more context, but maybe it should also be an `else if(...)`to make 
this code's relationship with the above more clear?




Comment at: clang/lib/Driver/ToolChains/CommonArgs.cpp:622
 CmdArgs.push_back(Args.MakeArgString(Twine(PluginPrefix) + Plugin));
+  }else{
+// For LLD we need to enable fat object support

tejohnson wrote:
> nit: missing spaces
TY. Looks like it needs a `git clang-format`. I'll be sure to run that again 
when I address the other comments.



Comment at: clang/lib/Driver/ToolChains/CommonArgs.cpp:625
+if (Args.hasArg(options::OPT_ffat_lto_objects))
+  CmdArgs.push_back("-fat-lto-objects");
   }

tejohnson wrote:
> Needs a test
Noted.



Comment at: clang/test/CodeGen/embed-lto-fatlto.c:2
+// RUN: %clang -cc1 -triple x86_64-unknown-linux-gnu -S -flto=full 
-ffat-lto-objects -emit-llvm < %s  | FileCheck %s
+// RUN: %clang -cc1 -triple x86_64-unknown-linux-gnu -S -flto=full 
-ffat-lto-objects -emit-llvm < %s  | FileCheck %s
+//

tejohnson wrote:
> Can you also test -flto=thin, with and without LTO splitting enabled?
will do.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146777/new/

https://reviews.llvm.org/D146777

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


[PATCH] D153059: [-Wunsafe-buffer-usage][WIP] Group parameter fix-its

2023-06-15 Thread Rashmi Mudduluru via Phabricator via cfe-commits
t-rasmud added inline comments.



Comment at: clang/lib/Analysis/UnsafeBufferUsage.cpp:2264
+  // variable `x` implicates fixing `y`:
   DepMapTy PtrAssignmentGraph{};
+

ziqingluo-90 wrote:
> ziqingluo-90 wrote:
> > How about changing the variable name to `PtrImplicationGraph`?  For two 
> > variables `V` and `W`,  if `W` is in `PtrImplicationGraph[V]`, it means 
> > fixing `V` implicates fixing `W`, right?
> @t-rasmud what do you think?
Sounds good! `PtrImplicationGraph ` conveys the same meaning as 
`PtrAssignmentGraph ` and is more generic.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153059/new/

https://reviews.llvm.org/D153059

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


[PATCH] D152764: [clang-tidy] Reserved-identifier: Improved AllowedIdentifiers option to support regular expressions

2023-06-15 Thread Piotr Zegar via Phabricator via cfe-commits
PiotrZSL accepted this revision.
PiotrZSL added a comment.
This revision is now accepted and ready to land.

Overall looks good..




Comment at: clang-tools-extra/clang-tidy/bugprone/ReservedIdentifierCheck.cpp:50
+if (!AllowedIdentifiers.back().isValid())
+  configurationDiag("Invalid allowed identifier regex '%0'") << Identifier;
+  }

you may remove that last one that is not valid from an AllowedIdentifiers, 
simply use pop_back()



Comment at: clang-tools-extra/docs/ReleaseNotes.rst:246
 
+- Improved option `AllowedIdentifiers` from :doc:`bugprone-reserved-identifier
+  ` to support regular

Consider following current approach: "Improved the bugprone-reserved-identifier 
check by enhancing the AllowedIdentifiers option to support regular 
expressions."



Comment at: clang-tools-extra/docs/ReleaseNotes.rst:247
+- Improved option `AllowedIdentifiers` from :doc:`bugprone-reserved-identifier
+  ` to support regular
+  expressions.

consider inserting here "check"


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152764/new/

https://reviews.llvm.org/D152764

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


[PATCH] D153059: [-Wunsafe-buffer-usage][WIP] Group parameter fix-its

2023-06-15 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added inline comments.



Comment at: clang/lib/Analysis/UnsafeBufferUsage.cpp:2264
+  // variable `x` implicates fixing `y`:
   DepMapTy PtrAssignmentGraph{};
+

ziqingluo-90 wrote:
> How about changing the variable name to `PtrImplicationGraph`?  For two 
> variables `V` and `W`,  if `W` is in `PtrImplicationGraph[V]`, it means 
> fixing `V` implicates fixing `W`, right?
@t-rasmud what do you think?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153059/new/

https://reviews.llvm.org/D153059

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


[PATCH] D151361: [CUDA] bump supported CUDA version to 12.1/11.8

2023-06-15 Thread Alexey Bader via Phabricator via cfe-commits
bader added inline comments.



Comment at: clang/docs/ReleaseNotes.rst:590
 
+- Clang now supports CUDA SDK up to 12.1
 

tra wrote:
> bader wrote:
> > @tra, could you update llvm/docs/CompileCudaWithLLVM.rst as well, please?
> Done in  d028188412fa54774e2c60e21f0929a0fede93bb
Great. Thank you!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151361/new/

https://reviews.llvm.org/D151361

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


[PATCH] D153078: [clang][dataflow] Change iteration algorithm to use WTO instead of reverse post order.

2023-06-15 Thread Yitzhak Mandelbaum via Phabricator via cfe-commits
ymandel created this revision.
ymandel added reviewers: xazax.hun, gribozavr.
Herald added a subscriber: martong.
Herald added a reviewer: NoQ.
Herald added a project: All.
ymandel requested review of this revision.
Herald added a project: clang.

This patch replaces use of the reverse-post order (RPO) based worklist with one
based on a weak topological order (WTO). The WTO gives better guarantees on
maximum number of times we'll visit each node in the CFG. The new test case
fails (because of too many iterations) with RPO but passes with WTO.

Ideally, we could iterate using WTO directly without a worklist, but this isn't
yet possible because our widening is limited to booleans. Once we have full
widening at loop heads, we can simplify further to guide the iteration directly
from the WTO's structure.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D153078

Files:
  clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp
  clang/unittests/Analysis/FlowSensitive/LoggerTest.cpp
  clang/unittests/Analysis/FlowSensitive/TransferTest.cpp

Index: clang/unittests/Analysis/FlowSensitive/TransferTest.cpp
===
--- clang/unittests/Analysis/FlowSensitive/TransferTest.cpp
+++ clang/unittests/Analysis/FlowSensitive/TransferTest.cpp
@@ -2673,6 +2673,49 @@
   });
 }
 
+TEST(TransferTest, SequencedWhilesNoTimeout) {
+  std::string Code = R"(
+void target() {
+  bool b = true;
+  while (b) {
+b = false;
+  }
+  b = true;
+  while (b) {
+b = false;
+  }
+  b = true;
+  while (b) {
+b = false;
+  }
+  b = true;
+  while (b) {
+b = false;
+  }
+  b = true;
+  while (b) {
+b = false;
+  }
+  b = true;
+  while (b) {
+b = false;
+  }
+  b = true;
+  while (b) {
+b = false;
+  }
+  (void)0;
+  /*[[p]]*/
+}
+  )";
+  runDataflow(
+  Code,
+  [](const llvm::StringMap> &Results,
+ ASTContext &ASTCtx) {
+EXPECT_EQ(Results.size(), 1u);
+  });
+}
+
 TEST(TransferTest, AggregateInitialization) {
   std::string BracesCode = R"(
 struct A {
Index: clang/unittests/Analysis/FlowSensitive/LoggerTest.cpp
===
--- clang/unittests/Analysis/FlowSensitive/LoggerTest.cpp
+++ clang/unittests/Analysis/FlowSensitive/LoggerTest.cpp
@@ -123,17 +123,17 @@
 transfer()
 recordState(Elements=2, Branches=0, Joins=0)
 
-enterBlock(3)
-transferBranch(0)
+enterBlock(2)
+transferBranch(1)
 recordState(Elements=2, Branches=1, Joins=0)
-enterElement(q)
+enterElement(p)
 transfer()
 recordState(Elements=3, Branches=1, Joins=0)
 
-enterBlock(2)
-transferBranch(1)
+enterBlock(3)
+transferBranch(0)
 recordState(Elements=2, Branches=1, Joins=0)
-enterElement(p)
+enterElement(q)
 transfer()
 recordState(Elements=3, Branches=1, Joins=0)
 
Index: clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp
===
--- clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp
+++ clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp
@@ -395,8 +395,15 @@
 std::function
 PostVisitCFG) {
-  PostOrderCFGView POV(&CFCtx.getCFG());
-  ForwardDataflowWorklist Worklist(CFCtx.getCFG(), &POV);
+  std::optional WTO = getIntervalWTO(CFCtx.getCFG());
+  if (!WTO)
+return llvm::createStringError(std::errc::invalid_argument,
+   "input CFG not reducible");
+  WTOCompare Cmp(*WTO);
+  WTODataflowWorklist Worklist(CFCtx.getCFG(), Cmp);
+  // FIXME: provide fallback?
+  // PostOrderCFGView POV(&CFCtx.getCFG());
+  // ForwardDataflowWorklist Worklist(CFCtx.getCFG(), &POV);
 
   std::vector> BlockStates(
   CFCtx.getCFG().size(), std::nullopt);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D151361: [CUDA] bump supported CUDA version to 12.1/11.8

2023-06-15 Thread Artem Belevich via Phabricator via cfe-commits
tra added inline comments.



Comment at: clang/docs/ReleaseNotes.rst:590
 
+- Clang now supports CUDA SDK up to 12.1
 

bader wrote:
> @tra, could you update llvm/docs/CompileCudaWithLLVM.rst as well, please?
Done in  d028188412fa54774e2c60e21f0929a0fede93bb


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151361/new/

https://reviews.llvm.org/D151361

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


[PATCH] D152986: [clang] Allow 'nomerge' attribute for function pointers

2023-06-15 Thread Eduard Zingerman via Phabricator via cfe-commits
eddyz87 added a comment.

In D152986#4425736 , @rnk wrote:

> 

Thank you for the review!

> The purpose of the attribute is really limited to preserving source location 
> information on instructions, and this isn't really a supported usage.

But it would prevent merging, right? I understand that using this attribute 
might block some legitimate optimizations.
Or do you mean that it is a "best effort" thing and not all transformations 
might honor it?

> The BPF backend and verifier needs to learn to tolerate valid LLVM transforms 
> if it wants to be a real LLVM backend. Of course, you can do what you like.

Well, I agree with that. The issue here is with the map API design: it is 
polymorphic, but it is expected that at load time verifier can replace all 
polymorphic calls with static calls.
People know it and write code in a way that allows verifier to infer which 
static functions to call. So I have limited options here:

- either adjust IR at early stages of pipeline so that specific calls are not 
altered;
- or do nothing and recommend users to use `[[clang::nomerge]]` on statement 
level or insert something like `asm volatile ("" :::"memory")` here and there.

But, yeah, I understand that is is not a C language semantics and headache is 
mine.

> Considered in the context of the original use case, I think it's reasonable 
> to allow the attribute on function pointers for the same reasons we allow it 
> on function declarations. It makes it easy to work the attribute onto the 
> direct call sites of the function without modifying tons of source code. 
> However, I'd like to see clearer documentation on the limitations.

Please see my "inline" response.




Comment at: clang/include/clang/Basic/AttrDocs.td:551-555
 calls to the specified function from merging. It has no effect on indirect 
 calls.
+
+``nomerge`` attribute can be specified for pointers to functions, all
+calls done through such pointer would be protected from merging.

rnk wrote:
> This statement of the attribute having "no effect on indirect calls" is 
> slightly confusing now that we talk about function pointers immediately 
> afterward. Can you please rework this a bit, and clarify that when applied to 
> function pointers, the attribute only takes effect when the call target is 
> directly the variable which carries the attribute? For example, this has no 
> effect:
> ```
> void (*fp)() __attribute__((nomerge));
> void callit() {
>   auto tmp = fp;
>   tmp();
>   (*fp)(); // I think TargetDecl will be null in the code, tell me if I'm 
> wrong
> }
> ```
I can make it more elaborate, would the text as below be fine?
Regarding TargetDecl value it is not null both times:
- `(VarDecl 'tmp' (ImplicitCastExpr (DeclRefExpr (Var fp`
- `(VarDecl 'fp')`

---

``nomerge`` attribute can also be used as function attribute to prevent all 
calls to the specified function from merging. It has no effect on indirect 
calls to such functions. For example:

.. code-block:: c++

  [[clang::nomerge]] void foo(int) {}
  
  void bar(int x) {
auto *ptr = foo;
if (x) foo(1); else foo(2); // will not be merged
if (x) ptr(1); else ptr(2); // indirect call, can be merged
  }

``nomerge`` attribute can also be used for pointers to functions to
prevent calls through such pointer from merging. In such case the
effect applies only to a specific function pointer. For example:

.. code-block:: c++

  [[clang::nomerge]] void (*foo)(int);
  
  void bar(int x) {
auto *ptr = foo;
if (x) foo(1); else foo(2); // will not be merged
if (x) ptr(1); else ptr(2); // 'ptr' has no 'nomerge' attribute,
// can be merged
  }



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152986/new/

https://reviews.llvm.org/D152986

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


[PATCH] D151361: [CUDA] bump supported CUDA version to 12.1/11.8

2023-06-15 Thread Alexey Bader via Phabricator via cfe-commits
bader added inline comments.



Comment at: clang/docs/ReleaseNotes.rst:590
 
+- Clang now supports CUDA SDK up to 12.1
 

@tra, could you update llvm/docs/CompileCudaWithLLVM.rst as well, please?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151361/new/

https://reviews.llvm.org/D151361

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


[PATCH] D146148: Float_t and double_t types shouldn't be modified by #pragma clang fp eval_method

2023-06-15 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments.



Comment at: clang/include/clang/Basic/IdentifierTable.h:85
+///  (including not_interesting).
+///   - The rest of the values represent builtin IDs (including not_builtin).
+static constexpr int FirstObjCKeywordID = 1;

The code below does not represent NotBuiltin (that's what adding and 
subtracting 1 does).



Comment at: clang/include/clang/Basic/IdentifierTable.h:89
+static constexpr int FirstInterestingIdentifierID = LastObjCKeywordID + 1;
+static constexpr int LastInterestingIdentifierID = LastObjCKeywordID + 
tok::NUM_INTERESTING_IDENTIFIERS;
+static constexpr int FirstBuiltinID = LastInterestingIdentifierID + 1;

I see that I had a bug in my suggestion: I had meant to write 
`LastInterestingIdentifierID = FirstInterestingIdentifierID + 
tok::NUM_INTERESTING_IDENTIFIERS - 2;` but I left it in terms of 
`LastObjCKeywordID` instead, making the ranges off by 1.  Your math fixes that; 
sorry about that.  I do think it would be clearer if each of these chained off 
the last one, the way I meant to have it, though.  So with your ranges (which 
leave space to explicitly represent `not_interesting`), that would look like 
`LastInterestingIdentifierID = FirstInterestingIdentifierID + 
tok::NUM_INTERESTING_IDENTIFIERS - 1;`.

I'm not going to push you to not represent `not_interesting`, since you seem to 
have deliberately changed things back that way, and I don't think it matters 
that much.  Although maybe you did that just because it didn't work in the code 
I gave you?  It would be more consistent with the other enums to not explicitly 
represent `not_interesting`.



Comment at: clang/include/clang/Basic/IdentifierTable.h:325
   void setBuiltinID(unsigned ID) {
-ObjCOrBuiltinID = ID + tok::NUM_OBJC_KEYWORDS;
-assert(ObjCOrBuiltinID - unsigned(tok::NUM_OBJC_KEYWORDS) == ID
-   && "ID too large for field!");
+ObjCOrBuiltinID = FirstBuiltinID + (ID - 1);
+assert(getBuiltinID() == ID && "ID too large for field!");

`initializeBuiltins` does call `setBuiltinID(NotBuiltin)` in order to reset any 
identifiers for which we have a  `-fno-builtin=X` argument, so you need to 
handle that somehow, because otherwise this is going to underflow and set up 
the identifier with the last `InterestingIdentifierKind`.  There are two 
options:
- You could just make `initializeBuiltins` call some sort of `clearBuiltinID` 
method that resets `ObjCOrBuiltinID` to 0.  That has the advantage of making 
the "lifecycle" of this field much more straightforward.  For example, we 
probably ought to be asserting in these methods that we're not overwriting 
existing data; `clearBuiltinID` would know that it was okay to clear data, but 
only from a builtin.
- You could also just check for `NotBuiltin` and set `ObjCBuiltinID = 0` when 
you see it.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146148/new/

https://reviews.llvm.org/D146148

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


[PATCH] D152275: Use memory region declaration intrinsic when generating code for array subscripts

2023-06-15 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment.

In D152275#4423845 , @simeon wrote:

>> - User code might not actually obey the language rules; do we have any 
>> sanitizer that checks if user code trips over this?
>
> I believe AddressSanitizer 
>  should be able to detect 
> out-of-bounds accesses.

asan will detect if you index completely outside a memory allocation, but it 
won't detect if you do something like `struct S { int x[10]; int y; } s = {}; 
return s->x[10];`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152275/new/

https://reviews.llvm.org/D152275

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


[PATCH] D144911: adding bf16 support to NVPTX

2023-06-15 Thread Artem Belevich via Phabricator via cfe-commits
tra added inline comments.



Comment at: llvm/lib/Target/NVPTX/NVPTXIntrinsics.td:1271-1287
-def : Pat<(int_nvvm_ff2f16x2_rn Float32Regs:$a, Float32Regs:$b),
-  (CVT_f16x2_f32 Float32Regs:$a, Float32Regs:$b, CvtRN)>;
-def : Pat<(int_nvvm_ff2f16x2_rn_relu Float32Regs:$a, Float32Regs:$b),
-  (CVT_f16x2_f32 Float32Regs:$a, Float32Regs:$b, CvtRN_RELU)>;
-def : Pat<(int_nvvm_ff2f16x2_rz Float32Regs:$a, Float32Regs:$b),
-  (CVT_f16x2_f32 Float32Regs:$a, Float32Regs:$b, CvtRZ)>;
-def : Pat<(int_nvvm_ff2f16x2_rz_relu Float32Regs:$a, Float32Regs:$b),

tra wrote:
> Were these patterns removed intentionally? We still have intrinsics/builtins 
> defined in llvm/include/llvm/IR/IntrinsicsNVVM.td and still need to lower 
> them.
^^^ this question is still unanswered.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144911/new/

https://reviews.llvm.org/D144911

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


[PATCH] D151938: [clang][index] NFCI: Make `CXFile` a `FileEntryRef`

2023-06-15 Thread Jake Egan via Phabricator via cfe-commits
Jake-Egan added a comment.

Hi, there's a test failure on AIX, could you take a look please?

https://lab.llvm.org/buildbot/#/builders/214/builds/8005/steps/6/logs/FAIL__Clang__index-with-module_m


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151938/new/

https://reviews.llvm.org/D151938

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


[PATCH] D150997: [llvm] Split out DenseMapInfo specialization

2023-06-15 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian updated this revision to Diff 531895.

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150997/new/

https://reviews.llvm.org/D150997

Files:
  clang-tools-extra/include-cleaner/include/clang-include-cleaner/Types.h
  flang/include/flang/Optimizer/HLFIR/HLFIROps.h
  llvm/include/llvm/ADT/DenseMapInfo.h
  llvm/include/llvm/ADT/DenseMapInfoVariant.h
  llvm/include/llvm/CodeGen/CallingConvLower.h
  llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
  llvm/include/llvm/Object/DXContainer.h
  llvm/include/llvm/Transforms/Scalar/SROA.h
  llvm/unittests/ADT/DenseMapTest.cpp
  mlir/include/mlir/IR/AsmState.h
  mlir/include/mlir/Transforms/SROA.h

Index: mlir/include/mlir/Transforms/SROA.h
===
--- mlir/include/mlir/Transforms/SROA.h
+++ mlir/include/mlir/Transforms/SROA.h
@@ -13,9 +13,10 @@
 #include "mlir/Interfaces/MemorySlotInterfaces.h"
 #include "mlir/Support/LogicalResult.h"
 #include "llvm/ADT/Statistic.h"
+#include 

 namespace mlir {

 /// Statistics collected while applying SROA.
 struct SROAStatistics {
   /// Total amount of memory slots destructured.
Index: mlir/include/mlir/IR/AsmState.h
===
--- mlir/include/mlir/IR/AsmState.h
+++ mlir/include/mlir/IR/AsmState.h
@@ -20,20 +20,21 @@
 #include "llvm/ADT/StringMap.h"

 #include 
+#include 

 namespace mlir {
 class AsmResourcePrinter;
 class AsmDialectResourceHandle;
 class Operation;

 namespace detail {
 class AsmStateImpl;
 } // namespace detail

 //===--===//
 // Resources
 //===--===//

 /// The following classes enable support for parsing and printing resources
 /// within MLIR assembly formats. Resources are a mechanism by which dialects,
 /// and external clients, may attach additional information when parsing or
Index: llvm/unittests/ADT/DenseMapTest.cpp
===
--- llvm/unittests/ADT/DenseMapTest.cpp
+++ llvm/unittests/ADT/DenseMapTest.cpp
@@ -8,20 +8,21 @@

 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseMapInfo.h"
+#include "llvm/ADT/DenseMapInfoVariant.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
 #include 
 #include 
 #include 
 #include 

 using namespace llvm;

 namespace {

 uint32_t getTestKey(int i, uint32_t *) { return i; }
 uint32_t getTestValue(int i, uint32_t *) { return 42 + i; }

 uint32_t *getTestKey(int i, uint32_t **) {
   static uint32_t dummy_arr1[8192];
   assert(i < 8192 && "Only support 8192 dummy keys.");
Index: llvm/include/llvm/Transforms/Scalar/SROA.h
===
--- llvm/include/llvm/Transforms/Scalar/SROA.h
+++ llvm/include/llvm/Transforms/Scalar/SROA.h
@@ -21,10 +21,11 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/IR/PassManager.h"
 #include "llvm/IR/ValueHandle.h"
+#include 
 #include 

 namespace llvm {

 class AllocaInst;
 class LoadInst;
 class StoreInst;
Index: llvm/include/llvm/Object/DXContainer.h
===
--- llvm/include/llvm/Object/DXContainer.h
+++ llvm/include/llvm/Object/DXContainer.h
@@ -21,13 +21,14 @@
 #include "llvm/Support/Error.h"
 #include "llvm/Support/MemoryBufferRef.h"
 #include "llvm/TargetParser/Triple.h"
+#include 

 namespace llvm {
 namespace object {

 namespace DirectX {
 class PSVRuntimeInfo {

   // This class provides a view into the underlying resource array. The Resource
   // data is little-endian encoded and may not be properly aligned to read
   // directly from. The dereference operator creates a copy of the data and byte
Index: llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
===
--- llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
+++ llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
@@ -22,74 +22,75 @@
 #include "llvm/ExecutionEngine/Orc/ThreadSafeModule.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/ThreadPool.h"
+#include 

 namespace llvm {
 namespace orc {

 class LLJITBuilderState;
 class LLLazyJITBuilderState;
 class ObjectTransformLayer;
 class ExecutorProcessControl;

 /// A pre-fabricated ORC JIT stack that can serve as an alternative to MCJIT.
 ///
 /// Create instances using LLJITBuilder.
 class LLJIT {
   template  friend class LLJITBuilderSetters;

   friend Expected setUpGenericLLVMIRPlatform(LLJIT &J);

 public:
   /// Initializer support for LLJIT.
   class PlatformSupport {
   public:
 virtual ~PlatformSupport();

 virtual Error initialize(JITDylib &JD) = 0;

 virtual Error deinitialize(JITDylib &JD) = 0;

   protected:
 static void setInitTransform(LLJIT &J,
  IRTransformLayer::TransformFunction T);
   };

   /// Destruct this instance. If a multi-threaded instance, wait

[PATCH] D153071: [clang][dataflow] Refactor `DataflowWorklist` types and add a WTO version.

2023-06-15 Thread Yitzhak Mandelbaum via Phabricator via cfe-commits
ymandel created this revision.
ymandel added reviewers: xazax.hun, gribozavr.
Herald added a subscriber: martong.
Herald added a reviewer: NoQ.
Herald added a project: All.
ymandel requested review of this revision.
Herald added a project: clang.

Removes dependency of the DataflowWorklistBase type on the PostOrderCFGView. The
base had no particular connection to this order -- looks like it was included as
a convenience to the two derived classes rather than because it belonged there
conceptually. Removing it cleans up the base class a bit and makes it suitable
to extension with the new WTODataflowWorklist class.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D153071

Files:
  clang/include/clang/Analysis/FlowSensitive/DataflowWorklist.h
  clang/unittests/Analysis/CFGTest.cpp

Index: clang/unittests/Analysis/CFGTest.cpp
===
--- clang/unittests/Analysis/CFGTest.cpp
+++ clang/unittests/Analysis/CFGTest.cpp
@@ -6,13 +6,15 @@
 //
 //===--===//
 
+#include "clang/Analysis/CFG.h"
 #include "CFGBuildResult.h"
 #include "clang/AST/Decl.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/Analysis/Analyses/IntervalPartition.h"
 #include "clang/Analysis/AnalysisDeclContext.h"
-#include "clang/Analysis/CFG.h"
 #include "clang/Analysis/FlowSensitive/DataflowWorklist.h"
 #include "clang/Tooling/Tooling.h"
+#include "gmock/gmock.h"
 #include "gtest/gtest.h"
 #include 
 #include 
@@ -244,6 +246,8 @@
 TEST(CFG, Worklists) {
   const char *Code = "int f(bool cond) {\n"
  "  int a = 5;\n"
+ "  while (a < 6)\n"
+ "++a;\n"
  "  if (cond)\n"
  "a += 1;\n"
  "  return a;\n"
@@ -272,6 +276,30 @@
ForwardNodes.begin()));
   }
 
+  // RPO: 876321054
+  // WTO: 876534210
+  // So, we construct the WTO order accordingly from the reference order.
+  std::vector WTOOrder = {
+  ReferenceOrder[0], ReferenceOrder[1], ReferenceOrder[2],
+  ReferenceOrder[7], ReferenceOrder[3], ReferenceOrder[8],
+  ReferenceOrder[4], ReferenceOrder[5], ReferenceOrder[6]};
+
+  {
+using ::testing::ElementsAreArray;
+std::optional WTO = getIntervalWTO(*CFG);
+ASSERT_TRUE(WTO);
+WTOCompare WCmp(*WTO);
+WTODataflowWorklist WTOWorklist(*CFG, WCmp);
+for (const auto *B : *CFG)
+  WTOWorklist.enqueueBlock(B);
+
+std::vector WTONodes;
+while (const CFGBlock *B = WTOWorklist.dequeue())
+  WTONodes.push_back(B);
+
+EXPECT_THAT(WTONodes, ElementsAreArray(WTOOrder));
+  }
+
   std::reverse(ReferenceOrder.begin(), ReferenceOrder.end());
 
   {
Index: clang/include/clang/Analysis/FlowSensitive/DataflowWorklist.h
===
--- clang/include/clang/Analysis/FlowSensitive/DataflowWorklist.h
+++ clang/include/clang/Analysis/FlowSensitive/DataflowWorklist.h
@@ -12,6 +12,7 @@
 #ifndef LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_DATAFLOWWORKLIST_H
 #define LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_DATAFLOWWORKLIST_H
 
+#include "clang/Analysis/Analyses/IntervalPartition.h"
 #include "clang/Analysis/Analyses/PostOrderCFGView.h"
 #include "clang/Analysis/CFG.h"
 #include "llvm/ADT/PriorityQueue.h"
@@ -21,16 +22,13 @@
 /// on the order defined by 'Comp'.
 template  class DataflowWorklistBase {
   llvm::BitVector EnqueuedBlocks;
-  PostOrderCFGView *POV;
   llvm::PriorityQueue, Comp>
   WorkList;
 
 public:
-  DataflowWorklistBase(const CFG &Cfg, PostOrderCFGView *POV, Comp C)
-  : EnqueuedBlocks(Cfg.getNumBlockIDs()), POV(POV), WorkList(C) {}
-
-  const PostOrderCFGView *getCFGView() const { return POV; }
+  DataflowWorklistBase(const CFG &Cfg, Comp C)
+  : EnqueuedBlocks(Cfg.getNumBlockIDs()), WorkList(C) {}
 
   void enqueueBlock(const CFGBlock *Block) {
 if (Block && !EnqueuedBlocks[Block->getBlockID()]) {
@@ -62,7 +60,7 @@
 struct ForwardDataflowWorklist
 : DataflowWorklistBase {
   ForwardDataflowWorklist(const CFG &Cfg, PostOrderCFGView *POV)
-  : DataflowWorklistBase(Cfg, POV,
+  : DataflowWorklistBase(Cfg,
  ReversePostOrderCompare{POV->getComparator()}) {}
 
   ForwardDataflowWorklist(const CFG &Cfg, AnalysisDeclContext &Ctx)
@@ -74,6 +72,19 @@
   }
 };
 
+/// A worklist implementation for forward dataflow analysis based on a weak
+/// topological ordering of the nodes. The worklist cannot contain the same
+/// block multiple times at once.
+struct WTODataflowWorklist : DataflowWorklistBase {
+  WTODataflowWorklist(const CFG &Cfg, const WTOCompare &Cmp)
+  : DataflowWorklistBase(Cfg, Cmp) {}
+
+  void enqueueSuccessors(const CFGBlock *Block) {
+for (auto B : Block->succs())
+  enqueueBlock(B);
+  }
+};
+
 /// A worklist implementation for backward dataflow analysis. The enqueued
 /// block will 

[PATCH] D152321: [clang] Replace use of Type::getPointerTo() (NFC)

2023-06-15 Thread Youngsuk Kim via Phabricator via cfe-commits
JOE1994 added a comment.

I do not have commit access yet.
Could one of the reviewers land this patch for me?
Please use "Youngsuk Kim " to commit the change. Thank 
you!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152321/new/

https://reviews.llvm.org/D152321

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


[PATCH] D151575: [clang][diagnostics] Always show include stacks on errors

2023-06-15 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment.

Judging by @aaron.ballman's comment on the bug, I can see the logic here.

Though perhaps this notion generalizes to all non-note types, not just errors 
(like perhaps we should print the include stack for each warning, too?)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151575/new/

https://reviews.llvm.org/D151575

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


[PATCH] D152321: [clang] Replace use of Type::getPointerTo() (NFC)

2023-06-15 Thread Nikita Popov via Phabricator via cfe-commits
nikic accepted this revision.
nikic added a comment.

LGTM -- do you have commit access, or should someone commit this for you?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152321/new/

https://reviews.llvm.org/D152321

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


[PATCH] D151349: [HIP] emit macro `__HIP_NO_IMAGE_SUPPORT`

2023-06-15 Thread Joseph Huber via Phabricator via cfe-commits
jhuber6 added a comment.

I've started seeing these errors when compiling for OpenMP targeting AMDGPU:

  $ clang input.c -fopenmp --offload-arch=gfx1030
  warning: feature flag '+image-insts' is ignored since the feature is read 
only [-Winvalid-command-line-argument]

Any suggestions for what might cause this?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151349/new/

https://reviews.llvm.org/D151349

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


[PATCH] D152321: [clang] Replace use of Type::getPointerTo() (NFC)

2023-06-15 Thread Youngsuk Kim via Phabricator via cfe-commits
JOE1994 added inline comments.



Comment at: clang/lib/CodeGen/TargetInfo.cpp:2045
   if (IsIndirect)
-LLTy = LLTy->getPointerTo(0);
+LLTy = llvm::PointerType::get(getVMContext(), 0);
   FrameFields.push_back(LLTy);

nikic wrote:
> getLLVMContext?
`getLLVMContext` doesn't seem available in this context.

Below is the build error message I get when using `getLLVMContext`.
```
~/llvm-project/clang/lib/CodeGen/TargetInfo.cpp: In member function 'void 
{anonymous}::X86_32ABIInfo::addFieldToArgStruct(llvm::SmallVector&, clang::CharUnits&, clang::CodeGen::ABIArgInfo&, clang::QualType) const':
~/llvm-project/clang/lib/CodeGen/TargetInfo.cpp:2057:41: error: 
'getLLVMContext' was not declared in this scope; did you mean 'getVMContext'?
```

On line 2066, `getVMContext` is used when a `LLVMContext&` is needed.
So I just followed it to use `getVMContext` on line 2057.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152321/new/

https://reviews.llvm.org/D152321

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


[PATCH] D152321: [clang] Replace use of Type::getPointerTo() (NFC)

2023-06-15 Thread Youngsuk Kim via Phabricator via cfe-commits
JOE1994 updated this revision to Diff 531889.
JOE1994 added a comment.

- Rebase onto latest llvm-project main : 
2cd4dc59792578f833b838e3c9a376a4bcafc568 


- Use `llvm::PointerType::getUnqual` whenever possible


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152321/new/

https://reviews.llvm.org/D152321

Files:
  clang/lib/CodeGen/CGAtomic.cpp
  clang/lib/CodeGen/CGBlocks.cpp
  clang/lib/CodeGen/CGBuilder.h
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGCUDANV.cpp
  clang/lib/CodeGen/CGCXX.cpp
  clang/lib/CodeGen/CGCXXABI.cpp
  clang/lib/CodeGen/CGClass.cpp
  clang/lib/CodeGen/CGDecl.cpp
  clang/lib/CodeGen/CGDeclCXX.cpp
  clang/lib/CodeGen/CGException.cpp
  clang/lib/CodeGen/CGExprCXX.cpp
  clang/lib/CodeGen/CGExprConstant.cpp
  clang/lib/CodeGen/CGObjCRuntime.cpp
  clang/lib/CodeGen/ItaniumCXXABI.cpp
  clang/lib/CodeGen/TargetInfo.cpp

Index: clang/lib/CodeGen/TargetInfo.cpp
===
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -402,7 +402,7 @@
   llvm::Type *DirectTy = CGF.ConvertTypeForMem(ValueTy), *ElementTy = DirectTy;
   if (IsIndirect) {
 unsigned AllocaAS = CGF.CGM.getDataLayout().getAllocaAddrSpace();
-DirectTy = DirectTy->getPointerTo(AllocaAS);
+DirectTy = llvm::PointerType::get(CGF.getLLVMContext(), AllocaAS);
   }
 
   Address Addr = emitVoidPtrDirectVAArg(CGF, VAListAddr, DirectTy, DirectSize,
@@ -2054,7 +2054,7 @@
   Info = ABIArgInfo::getInAlloca(FrameFields.size(), IsIndirect);
   llvm::Type *LLTy = CGT.ConvertTypeForMem(Type);
   if (IsIndirect)
-LLTy = LLTy->getPointerTo(0);
+LLTy = llvm::PointerType::getUnqual(getVMContext());
   FrameFields.push_back(LLTy);
   StackOffset += IsIndirect ? WordSize : getContext().getTypeSizeInChars(Type);
 
@@ -4863,7 +4863,8 @@
   Builder.CreateCondBr(CC, UsingRegs, UsingOverflow);
 
   llvm::Type *DirectTy = CGF.ConvertType(Ty), *ElementTy = DirectTy;
-  if (isIndirect) DirectTy = DirectTy->getPointerTo(0);
+  if (isIndirect)
+DirectTy = llvm::PointerType::getUnqual(CGF.getLLVMContext());
 
   // Case 1: consume registers.
   Address RegAddr = Address::invalid();
Index: clang/lib/CodeGen/ItaniumCXXABI.cpp
===
--- clang/lib/CodeGen/ItaniumCXXABI.cpp
+++ clang/lib/CodeGen/ItaniumCXXABI.cpp
@@ -584,9 +584,6 @@
   auto *RD =
   cast(MPT->getClass()->castAs()->getDecl());
 
-  llvm::FunctionType *FTy = CGM.getTypes().GetFunctionType(
-  CGM.getTypes().arrangeCXXMethodType(RD, FPT, /*FD=*/nullptr));
-
   llvm::Constant *ptrdiff_1 = llvm::ConstantInt::get(CGM.PtrDiffTy, 1);
 
   llvm::BasicBlock *FnVirtual = CGF.createBasicBlock("memptr.virtual");
@@ -687,8 +684,6 @@
   {VFPAddr, llvm::ConstantInt::get(CGM.Int32Ty, 0), TypeId});
   CheckResult = Builder.CreateExtractValue(CheckedLoad, 1);
   VirtualFn = Builder.CreateExtractValue(CheckedLoad, 0);
-  VirtualFn = Builder.CreateBitCast(VirtualFn, FTy->getPointerTo(),
-"memptr.virtualfn");
 } else {
   // When not doing VFE, emit a normal load, as it allows more
   // optimisations than type.checked.load.
@@ -709,15 +704,12 @@
 CGM.getIntrinsic(llvm::Intrinsic::load_relative,
  {VTableOffset->getType()}),
 {VTable, VTableOffset});
-VirtualFn = CGF.Builder.CreateBitCast(VirtualFn, FTy->getPointerTo());
   } else {
 llvm::Value *VFPAddr =
 CGF.Builder.CreateGEP(CGF.Int8Ty, VTable, VTableOffset);
-VFPAddr = CGF.Builder.CreateBitCast(
-VFPAddr, FTy->getPointerTo()->getPointerTo());
 VirtualFn = CGF.Builder.CreateAlignedLoad(
-FTy->getPointerTo(), VFPAddr, CGF.getPointerAlign(),
-"memptr.virtualfn");
+llvm::PointerType::getUnqual(CGF.getLLVMContext()), VFPAddr,
+CGF.getPointerAlign(), "memptr.virtualfn");
   }
 }
 assert(VirtualFn && "Virtual fuction pointer not created!");
@@ -757,8 +749,9 @@
   // In the non-virtual path, the function pointer is actually a
   // function pointer.
   CGF.EmitBlock(FnNonVirtual);
-  llvm::Value *NonVirtualFn =
-Builder.CreateIntToPtr(FnAsInt, FTy->getPointerTo(), "memptr.nonvirtualfn");
+  llvm::Value *NonVirtualFn = Builder.CreateIntToPtr(
+  FnAsInt, llvm::PointerType::getUnqual(CGF.getLLVMContext()),
+  "memptr.nonvirtualfn");
 
   // Check the function pointer if CFI on member function pointers is enabled.
   if (ShouldEmitCFICheck) {
@@ -799,7 +792,8 @@
 
   // We're done.
   CGF.EmitBlock(FnEnd);
-  llvm::PHINode *CalleePtr = Builder.CreatePHI(FTy->getPointerTo(), 2);
+  llvm::PHINode *CalleePtr =
+  Builder.CreatePHI(llvm::PointerType::getUnqual(CGF.getLLVMContext()), 2);
   CalleePtr->addIncoming(VirtualFn, FnVi

[PATCH] D153059: [-Wunsafe-buffer-usage][WIP] Group parameter fix-its

2023-06-15 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 added inline comments.



Comment at: clang/lib/Analysis/UnsafeBufferUsage.cpp:2085
   continue;
 }
 for (const auto &F : Fixables) {

I changed the rest of this function drastically so let me explain what I did.

The table `FixItsForVariable` is initiated with variables whose declarations 
and associated `Fixable`s can be fixed.  So if a variable is not in the table,  
either 1) its declaration cannot be fixed or 2) one of its `Fixable`s cannot be 
fixed.   Then, the table is further reduced by removing elements such that at 
least one of its' group members satisfies 1) or 2).
Eventually, the table  `FixItsForVariable` can be used to determine if a 
variable is `ImpossibleToFix` (so we no longer need this flag).   
`FixItsForVariable[V]`, if `V` exists there,  is a collection of fix-its for 
`V`'s declaration and all `Fixable`s associated to `V`.

With parameters being fixed, we also generate function overloads as fix-its for 
the parameters.  These overload fix-its are "shared" by the parameters.  It 
means that these fix-its will be added for the group where the parameters 
belong to, instead of being added to `FixItsForVariable[PV]` for each such 
parameter `PV`.

So finally, for a variable `V`, `FinalFixItsForVariable[V]` is a collection of 
fix-its for the whole group where `V` is at. 





Comment at: clang/lib/Analysis/UnsafeBufferUsage.cpp:2264
+  // variable `x` implicates fixing `y`:
   DepMapTy PtrAssignmentGraph{};
+

How about changing the variable name to `PtrImplicationGraph`?  For two 
variables `V` and `W`,  if `W` is in `PtrImplicationGraph[V]`, it means fixing 
`V` implicates fixing `W`, right?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153059/new/

https://reviews.llvm.org/D153059

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


[PATCH] D151575: [clang][diagnostics] Always show include stacks on errors

2023-06-15 Thread Zenong Zhang via Phabricator via cfe-commits
SlaterLatiao updated this revision to Diff 531885.
SlaterLatiao added a comment.

Remove unnecessary condition and assignment in implementation.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151575/new/

https://reviews.llvm.org/D151575

Files:
  clang/docs/ReleaseNotes.rst
  clang/lib/Frontend/DiagnosticRenderer.cpp
  clang/test/Misc/Inputs/include-stack-on-error-1.h
  clang/test/Misc/Inputs/include-stack-on-error-2.h
  clang/test/Misc/Inputs/include-stack-on-error-3.h
  clang/test/Misc/include-stack-on-error-1.cpp
  clang/test/Misc/include-stack-on-error-2.cpp

Index: clang/test/Misc/include-stack-on-error-2.cpp
===
--- /dev/null
+++ clang/test/Misc/include-stack-on-error-2.cpp
@@ -0,0 +1,15 @@
+// Test duplicate include stacks that are not on a new error are skipped.
+// RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-show-note-include-stack -I %S/Inputs %s 2>&1 | FileCheck %s -check-prefix=NOTESTACK
+
+#include "include-stack-on-error-1.h"
+#include "include-stack-on-error-3.h"
+
+// NOTESTACK:  In file included from
+// NOTESTACK: error: no matching function for call to 'b1'
+// This include should be skipped due to duplicate include location.
+// NOTESTACK-NOT:  In file included from
+// NOTESTACK: note: candidate function not viable
+// NOTESTACK:  In file included from
+// NOTESTACK: error: invalid operands to binary expression
+// NOTESTACK:  In file included from
+// NOTESTACK: note: in instantiation of function template specialization
Index: clang/test/Misc/include-stack-on-error-1.cpp
===
--- /dev/null
+++ clang/test/Misc/include-stack-on-error-1.cpp
@@ -0,0 +1,24 @@
+// Test duplicate include stacks on a new error are not skipped.
+// RUN: not %clang_cc1 -fsyntax-only -I %S/Inputs %s 2>&1 | FileCheck %s -check-prefix=STACK
+// RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-show-note-include-stack -I %S/Inputs %s 2>&1 | FileCheck %s -check-prefix=NOTESTACK
+
+#include "include-stack-on-error-1.h"
+#include "include-stack-on-error-2.h"
+
+// STACK:  In file included from
+// STACK: error: no matching function for call to 'b1'
+// STACK-NOT:  In file included from
+// STACK: note: candidate function not viable
+// STACK:  In file included from
+// STACK: error: invalid operands to binary expression
+// STACK-NOT:  In file included from
+// STACK: note: in instantiation of function template specialization
+
+// NOTESTACK:  In file included from
+// NOTESTACK: error: no matching function for call to 'b1'
+// NOTESTACK:  In file included from
+// NOTESTACK: note: candidate function not viable
+// NOTESTACK:  In file included from
+// NOTESTACK: error: invalid operands to binary expression
+// NOTESTACK:  In file included from
+// NOTESTACK: note: in instantiation of function template specialization
Index: clang/test/Misc/Inputs/include-stack-on-error-3.h
===
--- /dev/null
+++ clang/test/Misc/Inputs/include-stack-on-error-3.h
@@ -0,0 +1,5 @@
+void b1();
+void c() {
+b1(0);
+b2("0", "0");
+}
Index: clang/test/Misc/Inputs/include-stack-on-error-2.h
===
--- /dev/null
+++ clang/test/Misc/Inputs/include-stack-on-error-2.h
@@ -0,0 +1,4 @@
+void c() {
+b1(0);
+b2("0", "0");
+}
Index: clang/test/Misc/Inputs/include-stack-on-error-1.h
===
--- /dev/null
+++ clang/test/Misc/Inputs/include-stack-on-error-1.h
@@ -0,0 +1,2 @@
+void b1();
+template  void b2(T x, T y) { x + y; }
Index: clang/lib/Frontend/DiagnosticRenderer.cpp
===
--- clang/lib/Frontend/DiagnosticRenderer.cpp
+++ clang/lib/Frontend/DiagnosticRenderer.cpp
@@ -167,8 +167,8 @@
   PLoc.isInvalid() ? FullSourceLoc()
: FullSourceLoc(PLoc.getIncludeLoc(), Loc.getManager());
 
-  // Skip redundant include stacks altogether.
-  if (LastIncludeLoc == IncludeLoc)
+  // Skip redundant include stacks altogether on non-top-level.
+  if (Level != DiagnosticsEngine::Error && LastIncludeLoc == IncludeLoc)
 return;
 
   LastIncludeLoc = IncludeLoc;
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -319,6 +319,9 @@
   ``-fno-diagnostics-show-line-numbers``. At the same time, the maximum
   number of code lines it prints has been increased from 1 to 16. This
   can be controlled using ``-fcaret-diagnostics-max-lines=``.
+- Clang now does not skip the include stack on an error when it's a duplicate of 
+  the previous include stack.
+  (`#62001 `_)
 
 Bug Fixes in This Version
 -
__

[PATCH] D146148: Float_t and double_t types shouldn't be modified by #pragma clang fp eval_method

2023-06-15 Thread Zahira Ammarguellat via Phabricator via cfe-commits
zahiraam added a comment.

Thanks.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146148/new/

https://reviews.llvm.org/D146148

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


[PATCH] D146148: Float_t and double_t types shouldn't be modified by #pragma clang fp eval_method

2023-06-15 Thread Zahira Ammarguellat via Phabricator via cfe-commits
zahiraam updated this revision to Diff 531884.
zahiraam marked an inline comment as done.

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146148/new/

https://reviews.llvm.org/D146148

Files:
  clang/docs/LanguageExtensions.rst
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Basic/IdentifierTable.h
  clang/include/clang/Basic/TokenKinds.def
  clang/include/clang/Basic/TokenKinds.h
  clang/lib/Basic/IdentifierTable.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaLookup.cpp
  clang/test/Sema/abi-check-1.cpp
  clang/test/Sema/abi-check-2.cpp
  clang/test/Sema/abi-check-3.cpp
  clang/test/Sema/attr-only-in-default-eval.cpp

Index: clang/test/Sema/attr-only-in-default-eval.cpp
===
--- /dev/null
+++ clang/test/Sema/attr-only-in-default-eval.cpp
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+typedef float float_t [[clang::available_only_in_default_eval_method]];
+using double_t __attribute__((available_only_in_default_eval_method)) = double;
+
+// expected-error@+1{{'available_only_in_default_eval_method' attribute only applies to typedefs}}
+class  __attribute__((available_only_in_default_eval_method)) C1 {
+};
+// expected-error@+1{{'available_only_in_default_eval_method' attribute only applies to typedefs}}
+class  [[clang::available_only_in_default_eval_method]] C2 {
+};
+
+// expected-error@+1{{'available_only_in_default_eval_method' attribute only applies to typedefs}}
+struct [[clang::available_only_in_default_eval_method]] S1;
+// expected-error@+1{{'available_only_in_default_eval_method' attribute only applies to typedefs}}
+struct __attribute__((available_only_in_default_eval_method)) S2;
+
+// expected-error@+1{{'available_only_in_default_eval_method' attribute only applies to typedefs}}
+void __attribute__((available_only_in_default_eval_method)) foo();
+// expected-error@+1{{'available_only_in_default_eval_method' attribute cannot be applied to types}}
+void [[clang::available_only_in_default_eval_method]] goo();
+// expected-error@+1{{'available_only_in_default_eval_method' attribute cannot be applied to types}}
+void bar() [[clang::available_only_in_default_eval_method]];
+// expected-error@+1{{'available_only_in_default_eval_method' attribute only applies to typedefs}}
+void barz() __attribute__((available_only_in_default_eval_method));
+
Index: clang/test/Sema/abi-check-3.cpp
===
--- /dev/null
+++ clang/test/Sema/abi-check-3.cpp
@@ -0,0 +1,86 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -DNOERROR %s
+// RUN: %clang_cc1 -fsyntax-only -verify -ffp-eval-method=extended -DNOERROR %s
+
+// RUN: %clang_cc1 -verify -fsyntax-only -ffp-eval-method=source %s
+// RUN: %clang_cc1 -verify -fsyntax-only -ffp-eval-method=double %s
+
+
+#ifdef NOERROR
+// expected-no-diagnostics
+typedef float float_t;
+typedef double double_t;
+#else
+typedef float float_t; //expected-error 9 {{cannot use type 'float_t' within '#pragma clang fp eval_method'; type is set according to the default eval method for the translation unit}}
+
+typedef double double_t; //expected-error 9 {{cannot use type 'double_t' within '#pragma clang fp eval_method'; type is set according to the default eval method for the translation unit}}
+#endif
+
+float foo1() {
+#pragma clang fp eval_method(extended)
+  float a;
+  double b;
+  return a - b;
+}
+
+float foo2() {
+#pragma clang fp eval_method(extended)
+  float_t a; 
+  double_t b; 
+  return a - b;
+}
+
+void foo3() {
+#pragma clang fp eval_method(extended)
+  char buff[sizeof(float_t)];
+  char bufd[sizeof(double_t)];
+  buff[1] = bufd[2];
+}
+
+float foo4() {
+#pragma clang fp eval_method(extended)
+  typedef float_t FT;
+  typedef double_t DT;
+  FT a;
+  DT b;
+  return a - b;
+}
+
+int foo5() {
+#pragma clang fp eval_method(extended)
+  int t = _Generic( 1.0L, float_t:1, default:0);
+  int v = _Generic( 1.0L, double_t:1, default:0);
+  return t;
+}
+
+void foo6() {
+#pragma clang fp eval_method(extended)
+  auto resf = [](float_t f) { return f; };
+  auto resd = [](double_t g) { return g; };
+}
+
+void foo7() {
+#pragma clang fp eval_method(extended)
+  float f = (float_t)1; 
+  double d = (double_t)2; 
+}
+
+void foo8() {
+#pragma clang fp eval_method(extended)
+  using Ft = float_t;
+  using Dt = double_t;
+  Ft a;
+  Dt b;
+}
+
+void foo9() {
+#pragma clang fp eval_method(extended)
+  float c1 = (float_t)12;
+  double c2 = (double_t)13;
+}
+
+float foo10() {
+#pragma clang fp eval_method(extended)
+  extern float_t f;
+  extern double_t g;
+  return f-g;
+}
Index: clang/test/Sema/abi-check-2.cpp
===
--- /dev/null
+++ clang/test/Sema/abi-check-2.cpp
@@ -0,0 +1,85 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -DNOERROR %s
+// RUN: %clang_cc1 -fsy

[PATCH] D153068: Remove unnecessary condition and assignment.

2023-06-15 Thread Zenong Zhang via Phabricator via cfe-commits
SlaterLatiao created this revision.
Herald added a project: All.
SlaterLatiao requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D153068

Files:
  clang/lib/Frontend/DiagnosticRenderer.cpp


Index: clang/lib/Frontend/DiagnosticRenderer.cpp
===
--- clang/lib/Frontend/DiagnosticRenderer.cpp
+++ clang/lib/Frontend/DiagnosticRenderer.cpp
@@ -167,12 +167,8 @@
   PLoc.isInvalid() ? FullSourceLoc()
: FullSourceLoc(PLoc.getIncludeLoc(), Loc.getManager());
 
-  // Reset `LastIncludeLoc` on a new error so that the include stacks are
-  // not skipped.
-  if (Level == DiagnosticsEngine::Error)
-LastIncludeLoc = SourceLocation();
-  // Skip redundant include stacks altogether.
-  if (LastIncludeLoc == IncludeLoc)
+  // Skip redundant include stacks altogether on non-top-level.
+  if (Level != DiagnosticsEngine::Error && LastIncludeLoc == IncludeLoc)
 return;
 
   LastIncludeLoc = IncludeLoc;


Index: clang/lib/Frontend/DiagnosticRenderer.cpp
===
--- clang/lib/Frontend/DiagnosticRenderer.cpp
+++ clang/lib/Frontend/DiagnosticRenderer.cpp
@@ -167,12 +167,8 @@
   PLoc.isInvalid() ? FullSourceLoc()
: FullSourceLoc(PLoc.getIncludeLoc(), Loc.getManager());
 
-  // Reset `LastIncludeLoc` on a new error so that the include stacks are
-  // not skipped.
-  if (Level == DiagnosticsEngine::Error)
-LastIncludeLoc = SourceLocation();
-  // Skip redundant include stacks altogether.
-  if (LastIncludeLoc == IncludeLoc)
+  // Skip redundant include stacks altogether on non-top-level.
+  if (Level != DiagnosticsEngine::Error && LastIncludeLoc == IncludeLoc)
 return;
 
   LastIncludeLoc = IncludeLoc;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D149444: [ARM] Allow codegen for Armv6m eXecute-Only (XO) sections

2023-06-15 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay accepted this revision.
MaskRay added a comment.

Looks great!




Comment at: clang/test/Driver/arm-execute-only.c:1
-// RUN: not %clang -c -target thumbv6m-eabi -mexecute-only %s 2>&1 | \
+// RUN: %clang -c -### --target=thumbv6m-eabi -mexecute-only %s 2>&1 | \
+// RUN:   FileCheck -allow-empty --check-prefix CHECK-EXECUTE-ONLY %s

stuij wrote:
> MaskRay wrote:
> > If you don't check -cc1 options with FileCheck, you can also replace `-###` 
> > with `-fdriver-only -Werror` and drop two `-NOT:` patterns below. You can 
> > play with some examples to see its effect:)
> > 
> > If the `clang -c -fdriver-only -Werror` command gives no output, you can 
> > use `... 2>&1 | count 0`
> Very useful info. Thanks for the tips!
LGTM once the simplification is done (e.g. `clang -c -fdriver-only -Werror`)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149444/new/

https://reviews.llvm.org/D149444

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


[PATCH] D150226: [Clang] Remove ability to downgrade warning on the diagnostic for setting a non fixed enum to a value outside the range of the enumeration values

2023-06-15 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment.

> My concern with `ShowInSystemHeaders` is that this seems like a bad user 
> experience.

I guess you're comparing this user experience to the one when this feature was 
a normal warning/without `ShowInSystemHeaders` - I'm comparing this situation 
to the future where this becomes a hard error with no escape hatch. 
`ShowInSystemHeaders` is more aggressive than the former & yeah, isn't terribly 
nice for users - but it's less aggressive than the latter, and gives users some 
escape hatch for now until the thing becomes a hard error & at least they know 
it's coming, maybe? (with enough text in the warning, etc)

So, yeah, I'd be inclined to make the change to `ShowInSystemHeaders` close to 
when you were going to make it a hard error, pushing back the hard-error change 
a little bit (maybe just one clang release? Maybe a couple? Not sure).

> If the system header triggers an error 1) some users aren't going to know how 
> to fix that by downgrading the diagnostic, so that may cause them to go 
> "Clang is buggy because  accepts this fine" (not the end of 
> the world, but frustrates both us and users). 2) the only recourse users have 
> is to downgrade/disable the diagnostic (otherwise they'd have to change 
> system header code), which they may likely do with a command line flag rather 
> than something more targeted like diagnostic pragmas around the include, 
> which increases the risk of users not seeing the issues in code they can 
> control.

They'd already have had a chance to deal with their code when this was a 
warning-default-error without "ShowInSystemHeaders"? (or, if the yhaven't 
picked up a new compiler often enough, and they go from "a warning we didn't 
care about" to "warning-default-error-with-ShowInSystemHeaders" - they're still 
better off than if it'd gone straight to hard error, some chance to cleanup 
while disabling the warning/error before picking up a compiler version that 
makes it a hard error)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150226/new/

https://reviews.llvm.org/D150226

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


[PATCH] D152975: [clang-format] Allow break after return keyword

2023-06-15 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks added a comment.

I'd like more tests (and examples how it is before the change), some operations 
(+, *, etc.), your stated string literal with and without many spaces, call 
chains.

I have nothing against the introduction, I'm just not sure about the default 
value and the position of the check in `splitPenalty`.

And please add a remark in the changelog.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152975/new/

https://reviews.llvm.org/D152975

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


[PATCH] D153058: [clang][CFG] Support construction of a weak topological ordering of the CFG.

2023-06-15 Thread Yitzhak Mandelbaum via Phabricator via cfe-commits
ymandel updated this revision to Diff 531874.
ymandel added a comment.

more comment expansion.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153058/new/

https://reviews.llvm.org/D153058

Files:
  clang/include/clang/Analysis/Analyses/IntervalPartition.h
  clang/lib/Analysis/IntervalPartition.cpp
  clang/unittests/Analysis/IntervalPartitionTest.cpp

Index: clang/unittests/Analysis/IntervalPartitionTest.cpp
===
--- clang/unittests/Analysis/IntervalPartitionTest.cpp
+++ clang/unittests/Analysis/IntervalPartitionTest.cpp
@@ -8,13 +8,119 @@
 
 #include "clang/Analysis/Analyses/IntervalPartition.h"
 #include "CFGBuildResult.h"
+#include "clang/Analysis/CFG.h"
+#include "llvm/Support/raw_ostream.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
+#include 
+#include 
 
 namespace clang {
-namespace analysis {
+
+namespace {
+template  using NodeData = CFGInterval::NodeData;
+}  // namespace
+
+llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
+  const CFGInterval::IntervalData &D) {
+  OS << "Nodes{";
+  if (std::holds_alternative>(D)) {
+auto &BlockData = std::get>(D);
+for (const auto *B : BlockData.Nodes)
+  OS << B->getBlockID() << ", ";
+  } else {
+assert(std::holds_alternative>(D));
+auto &IntervalData = std::get>(D);
+for (const auto *B : IntervalData.Nodes)
+  OS << B->ID << ", ";
+  }
+  OS << "}";
+  return OS;
+}
+
+llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const CFGInterval &I) {
+  OS << "Interval{ID = " << I.ID << ", ";
+  OS << I.Data;
+  OS << ", Pre{";
+  for (const auto *P : I.Predecessors)
+OS << P->ID << ",";
+  OS << "}, Succ{";
+  for (const auto *P : I.Successors)
+OS << P->ID << ",";
+  OS << "}}\n";
+  return OS;
+}
+
+void PrintTo(const CFGInterval::IntervalData &D, std::ostream *OS) {
+  std::string Result;
+  llvm::raw_string_ostream StringOS(Result);
+  StringOS << D;
+  *OS << Result;
+}
+
+void PrintTo(const CFGInterval &I, std::ostream *OS) {
+  std::string Result;
+  llvm::raw_string_ostream StringOS(Result);
+  StringOS << I;
+  *OS << Result;
+}
+
 namespace {
 
+using ::clang::analysis::BuildCFG;
+using ::clang::analysis::BuildResult;
+using ::testing::ElementsAre;
+using ::testing::Field;
+using ::testing::IsEmpty;
+using ::testing::Optional;
+using ::testing::UnorderedElementsAre;
+
+MATCHER_P(BlockID, ID, "") { return arg->getBlockID == ID; }
+MATCHER_P(IntervalID, ID, "") { return arg->ID == ID; }
+
+template 
+auto BlockIDs(T... IDs) {
+  return UnorderedElementsAre(
+  ::testing::Property(&CFGBlock::getBlockID, IDs)...);
+}
+
+template 
+auto IntervalIDs(T... IDs) {
+  return UnorderedElementsAre(
+  ::testing::Field(&CFGInterval::ID, IDs)...);
+}
+
+MATCHER_P3(IsBlockInterval, ID, Preds, Succs, "") {
+  if (!std::holds_alternative>(arg.Data))
+return false;
+
+  return testing::Matches(ID)(arg.ID) &&
+ testing::Matches(Preds)(arg.Predecessors) &&
+ testing::Matches(Succs)(arg.Successors);
+}
+
+MATCHER_P4(IsBlockInterval, ID, Nodes, Preds, Succs, "") {
+  if (!std::holds_alternative>(arg.Data))
+return false;
+  auto &IntervalData = std::get>(arg.Data);
+
+  return testing::Matches(ID)(arg.ID) &&
+ testing::Matches(Nodes)(IntervalData.Nodes) &&
+ testing::Matches(Preds)(arg.Predecessors) &&
+ testing::Matches(Succs)(arg.Successors);
+}
+
+MATCHER_P4(IsNestedInterval, ID, Nodes, Preds, Succs, "") {
+  if (!std::holds_alternative>(arg.Data))
+return false;
+  auto &IntervalData = std::get>(arg.Data);
+
+  return testing::Matches(ID)(arg.ID) &&
+ testing::Matches(Nodes)(IntervalData.Nodes) &&
+ testing::Matches(Preds)(arg.Predecessors) &&
+ testing::Matches(Succs)(arg.Successors);
+}
+
 TEST(BuildInterval, PartitionSimpleOneInterval) {
 
   const char *Code = R"(void f() {
@@ -32,8 +138,8 @@
 
   auto &EntryBlock = cfg->getEntry();
 
-  CFGInterval I = buildInterval(EntryBlock);
-  EXPECT_EQ(I.Blocks.size(), 3u);
+  std::vector I = buildInterval(&EntryBlock);
+  EXPECT_EQ(I.size(), 3u);
 }
 
 TEST(BuildInterval, PartitionIfThenOneInterval) {
@@ -56,12 +162,10 @@
 
   auto &EntryBlock = cfg->getEntry();
 
-  CFGInterval I = buildInterval(EntryBlock);
-  EXPECT_EQ(I.Blocks.size(), 6u);
+  std::vector I = buildInterval(&EntryBlock);
+  EXPECT_EQ(I.size(), 6u);
 }
 
-using ::testing::UnorderedElementsAre;
-
 TEST(BuildInterval, PartitionWhileMultipleIntervals) {
 
   const char *Code = R"(void f() {
@@ -80,11 +184,11 @@
   CFGBlock *InitXBlock = *EntryBlock->succ_begin();
   CFGBlock *LoopHeadBlock = *InitXBlock->succ_begin();
 
-  CFGInterval I1 = buildInterval(*EntryBlock);
-  EXPECT_THAT(I1.Blocks, UnorderedElementsAre(EntryBlock, InitXBlock));
+  std::vector I1 = buildInterval(EntryBlock);
+  EXPECT_THAT(I1, UnorderedElementsAre(EntryBlock, InitXBlock));
 
-  CFGInterval I2 = buildInterval(*LoopHe

[PATCH] D152813: [clang][dataflow] Create `Value`s for integer literals.

2023-06-15 Thread Martin Böhme via Phabricator via cfe-commits
mboehme marked 2 inline comments as done.
mboehme added inline comments.



Comment at: clang/include/clang/Analysis/FlowSensitive/Arena.h:89
+  /// `Value`. These literals are the same every time.
+  IntegerValue &makeIntLiteral(llvm::APInt Value);
+

xazax.hun wrote:
> gribozavr2 wrote:
> > Should we be taking the type into account? If not, why not? Please add the 
> > type or document why the type isn't tracked.
> What would happen if we try to create the same value (like 5) but with 
> different bit widths? (E.g., 64 bit integer vs 32 bit integer). I suspect we 
> might end up having the same value twice in our constant pool, which might be 
> fine. Just wanted to double check what is the desired behavior.
> Should we be taking the type into account? If not, why not? Please add the 
> type or document why the type isn't tracked.

I've clarified that the type isn't tracked but is instead determined by the 
`Expr` that the integer literal is associated with. (This is consistent with 
our treatment of `IntegerValue`s more generally.)

If we want to do constant propagation through integral conversions, this should 
be done when processing the `IntegerCast` node.  This would, if necessary, 
produce an integer literal with a different value.



Comment at: clang/include/clang/Analysis/FlowSensitive/Arena.h:89
+  /// `Value`. These literals are the same every time.
+  IntegerValue &makeIntLiteral(llvm::APInt Value);
+

mboehme wrote:
> xazax.hun wrote:
> > gribozavr2 wrote:
> > > Should we be taking the type into account? If not, why not? Please add 
> > > the type or document why the type isn't tracked.
> > What would happen if we try to create the same value (like 5) but with 
> > different bit widths? (E.g., 64 bit integer vs 32 bit integer). I suspect 
> > we might end up having the same value twice in our constant pool, which 
> > might be fine. Just wanted to double check what is the desired behavior.
> > Should we be taking the type into account? If not, why not? Please add the 
> > type or document why the type isn't tracked.
> 
> I've clarified that the type isn't tracked but is instead determined by the 
> `Expr` that the integer literal is associated with. (This is consistent with 
> our treatment of `IntegerValue`s more generally.)
> 
> If we want to do constant propagation through integral conversions, this 
> should be done when processing the `IntegerCast` node.  This would, if 
> necessary, produce an integer literal with a different value.
> What would happen if we try to create the same value (like 5) but with 
> different bit widths? (E.g., 64 bit integer vs 32 bit integer). I suspect we 
> might end up having the same value twice in our constant pool, which might be 
> fine. Just wanted to double check what is the desired behavior.

This isn't a consideration, as integer literals aren't typed (see reply to 
comment above).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152813/new/

https://reviews.llvm.org/D152813

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


[PATCH] D153058: [clang][CFG] Support construction of a weak topological ordering of the CFG.

2023-06-15 Thread Yitzhak Mandelbaum via Phabricator via cfe-commits
ymandel updated this revision to Diff 531865.
ymandel added a comment.

Fix build break and add some field comments.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153058/new/

https://reviews.llvm.org/D153058

Files:
  clang/include/clang/Analysis/Analyses/IntervalPartition.h
  clang/lib/Analysis/IntervalPartition.cpp
  clang/unittests/Analysis/IntervalPartitionTest.cpp

Index: clang/unittests/Analysis/IntervalPartitionTest.cpp
===
--- clang/unittests/Analysis/IntervalPartitionTest.cpp
+++ clang/unittests/Analysis/IntervalPartitionTest.cpp
@@ -8,13 +8,119 @@
 
 #include "clang/Analysis/Analyses/IntervalPartition.h"
 #include "CFGBuildResult.h"
+#include "clang/Analysis/CFG.h"
+#include "llvm/Support/raw_ostream.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
+#include 
+#include 
 
 namespace clang {
-namespace analysis {
+
+namespace {
+template  using NodeData = CFGInterval::NodeData;
+}  // namespace
+
+llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
+  const CFGInterval::IntervalData &D) {
+  OS << "Nodes{";
+  if (std::holds_alternative>(D)) {
+auto &BlockData = std::get>(D);
+for (const auto *B : BlockData.Nodes)
+  OS << B->getBlockID() << ", ";
+  } else {
+assert(std::holds_alternative>(D));
+auto &IntervalData = std::get>(D);
+for (const auto *B : IntervalData.Nodes)
+  OS << B->ID << ", ";
+  }
+  OS << "}";
+  return OS;
+}
+
+llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const CFGInterval &I) {
+  OS << "Interval{ID = " << I.ID << ", ";
+  OS << I.Data;
+  OS << ", Pre{";
+  for (const auto *P : I.Predecessors)
+OS << P->ID << ",";
+  OS << "}, Succ{";
+  for (const auto *P : I.Successors)
+OS << P->ID << ",";
+  OS << "}}\n";
+  return OS;
+}
+
+void PrintTo(const CFGInterval::IntervalData &D, std::ostream *OS) {
+  std::string Result;
+  llvm::raw_string_ostream StringOS(Result);
+  StringOS << D;
+  *OS << Result;
+}
+
+void PrintTo(const CFGInterval &I, std::ostream *OS) {
+  std::string Result;
+  llvm::raw_string_ostream StringOS(Result);
+  StringOS << I;
+  *OS << Result;
+}
+
 namespace {
 
+using ::clang::analysis::BuildCFG;
+using ::clang::analysis::BuildResult;
+using ::testing::ElementsAre;
+using ::testing::Field;
+using ::testing::IsEmpty;
+using ::testing::Optional;
+using ::testing::UnorderedElementsAre;
+
+MATCHER_P(BlockID, ID, "") { return arg->getBlockID == ID; }
+MATCHER_P(IntervalID, ID, "") { return arg->ID == ID; }
+
+template 
+auto BlockIDs(T... IDs) {
+  return UnorderedElementsAre(
+  ::testing::Property(&CFGBlock::getBlockID, IDs)...);
+}
+
+template 
+auto IntervalIDs(T... IDs) {
+  return UnorderedElementsAre(
+  ::testing::Field(&CFGInterval::ID, IDs)...);
+}
+
+MATCHER_P3(IsBlockInterval, ID, Preds, Succs, "") {
+  if (!std::holds_alternative>(arg.Data))
+return false;
+
+  return testing::Matches(ID)(arg.ID) &&
+ testing::Matches(Preds)(arg.Predecessors) &&
+ testing::Matches(Succs)(arg.Successors);
+}
+
+MATCHER_P4(IsBlockInterval, ID, Nodes, Preds, Succs, "") {
+  if (!std::holds_alternative>(arg.Data))
+return false;
+  auto &IntervalData = std::get>(arg.Data);
+
+  return testing::Matches(ID)(arg.ID) &&
+ testing::Matches(Nodes)(IntervalData.Nodes) &&
+ testing::Matches(Preds)(arg.Predecessors) &&
+ testing::Matches(Succs)(arg.Successors);
+}
+
+MATCHER_P4(IsNestedInterval, ID, Nodes, Preds, Succs, "") {
+  if (!std::holds_alternative>(arg.Data))
+return false;
+  auto &IntervalData = std::get>(arg.Data);
+
+  return testing::Matches(ID)(arg.ID) &&
+ testing::Matches(Nodes)(IntervalData.Nodes) &&
+ testing::Matches(Preds)(arg.Predecessors) &&
+ testing::Matches(Succs)(arg.Successors);
+}
+
 TEST(BuildInterval, PartitionSimpleOneInterval) {
 
   const char *Code = R"(void f() {
@@ -32,8 +138,8 @@
 
   auto &EntryBlock = cfg->getEntry();
 
-  CFGInterval I = buildInterval(EntryBlock);
-  EXPECT_EQ(I.Blocks.size(), 3u);
+  std::vector I = buildInterval(&EntryBlock);
+  EXPECT_EQ(I.size(), 3u);
 }
 
 TEST(BuildInterval, PartitionIfThenOneInterval) {
@@ -56,12 +162,10 @@
 
   auto &EntryBlock = cfg->getEntry();
 
-  CFGInterval I = buildInterval(EntryBlock);
-  EXPECT_EQ(I.Blocks.size(), 6u);
+  std::vector I = buildInterval(&EntryBlock);
+  EXPECT_EQ(I.size(), 6u);
 }
 
-using ::testing::UnorderedElementsAre;
-
 TEST(BuildInterval, PartitionWhileMultipleIntervals) {
 
   const char *Code = R"(void f() {
@@ -80,11 +184,11 @@
   CFGBlock *InitXBlock = *EntryBlock->succ_begin();
   CFGBlock *LoopHeadBlock = *InitXBlock->succ_begin();
 
-  CFGInterval I1 = buildInterval(*EntryBlock);
-  EXPECT_THAT(I1.Blocks, UnorderedElementsAre(EntryBlock, InitXBlock));
+  std::vector I1 = buildInterval(EntryBlock);
+  EXPECT_THAT(I1, UnorderedElementsAre(EntryBlock, InitXBlock));
 
-  CFGInterval I2 = 

[PATCH] D152813: [clang][dataflow] Create `Value`s for integer literals.

2023-06-15 Thread Martin Böhme via Phabricator via cfe-commits
mboehme updated this revision to Diff 531863.
mboehme added a comment.

Clarify that integer literals aren't typed.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152813/new/

https://reviews.llvm.org/D152813

Files:
  clang/include/clang/Analysis/FlowSensitive/Arena.h
  clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h
  clang/lib/Analysis/FlowSensitive/Arena.cpp
  clang/lib/Analysis/FlowSensitive/Transfer.cpp
  clang/unittests/Analysis/FlowSensitive/TransferTest.cpp

Index: clang/unittests/Analysis/FlowSensitive/TransferTest.cpp
===
--- clang/unittests/Analysis/FlowSensitive/TransferTest.cpp
+++ clang/unittests/Analysis/FlowSensitive/TransferTest.cpp
@@ -811,6 +811,31 @@
   });
 }
 
+TEST(TransferTest, BinaryOperatorAssignIntegerLiteral) {
+  std::string Code = R"(
+void target() {
+  int Foo = 1;
+  // [[before]]
+  Foo = 2;
+  // [[after]]
+}
+  )";
+  runDataflow(
+  Code,
+  [](const llvm::StringMap> &Results,
+ ASTContext &ASTCtx) {
+const Environment &Before =
+getEnvironmentAtAnnotation(Results, "before");
+const Environment &After = getEnvironmentAtAnnotation(Results, "after");
+
+const auto &ValBefore =
+getValueForDecl(ASTCtx, Before, "Foo");
+const auto &ValAfter =
+getValueForDecl(ASTCtx, After, "Foo");
+EXPECT_NE(&ValBefore, &ValAfter);
+  });
+}
+
 TEST(TransferTest, VarDeclInitAssign) {
   std::string Code = R"(
 void target() {
@@ -3441,6 +3466,24 @@
   });
 }
 
+TEST(TransferTest, IntegerLiteralEquality) {
+  std::string Code = R"(
+void target() {
+  bool equal = (42 == 42);
+  // [[p]]
+}
+  )";
+  runDataflow(
+  Code,
+  [](const llvm::StringMap> &Results,
+ ASTContext &ASTCtx) {
+const Environment &Env = getEnvironmentAtAnnotation(Results, "p");
+
+auto &Equal = getValueForDecl(ASTCtx, Env, "equal");
+EXPECT_TRUE(Env.flowConditionImplies(Equal));
+  });
+}
+
 TEST(TransferTest, CorrelatedBranches) {
   std::string Code = R"(
 void target(bool B, bool C) {
Index: clang/lib/Analysis/FlowSensitive/Transfer.cpp
===
--- clang/lib/Analysis/FlowSensitive/Transfer.cpp
+++ clang/lib/Analysis/FlowSensitive/Transfer.cpp
@@ -48,9 +48,15 @@
 
 static BoolValue &evaluateBooleanEquality(const Expr &LHS, const Expr &RHS,
   Environment &Env) {
-  if (auto *LHSValue = dyn_cast_or_null(Env.getValueStrict(LHS)))
-if (auto *RHSValue = dyn_cast_or_null(Env.getValueStrict(RHS)))
-  return Env.makeIff(*LHSValue, *RHSValue);
+  Value *LHSValue = Env.getValueStrict(LHS);
+  Value *RHSValue = Env.getValueStrict(RHS);
+
+  if (LHSValue == RHSValue)
+return Env.getBoolLiteralValue(true);
+
+  if (auto *LHSBool = dyn_cast_or_null(LHSValue))
+if (auto *RHSBool = dyn_cast_or_null(RHSValue))
+  return Env.makeIff(*LHSBool, *RHSBool);
 
   return Env.makeAtomicBoolValue();
 }
@@ -775,6 +781,10 @@
 Env.setValueStrict(*S, Env.getBoolLiteralValue(S->getValue()));
   }
 
+  void VisitIntegerLiteral(const IntegerLiteral *S) {
+Env.setValueStrict(*S, Env.getIntLiteralValue(S->getValue()));
+  }
+
   void VisitParenExpr(const ParenExpr *S) {
 // The CFG does not contain `ParenExpr` as top-level statements in basic
 // blocks, however manual traversal to sub-expressions may encounter them.
Index: clang/lib/Analysis/FlowSensitive/Arena.cpp
===
--- clang/lib/Analysis/FlowSensitive/Arena.cpp
+++ clang/lib/Analysis/FlowSensitive/Arena.cpp
@@ -68,4 +68,12 @@
   return *Res.first->second;
 }
 
+IntegerValue &Arena::makeIntLiteral(llvm::APInt Value) {
+  auto [It, Inserted] = IntegerLiterals.try_emplace(Value, nullptr);
+
+  if (Inserted)
+It->second = &create();
+  return *It->second;
+}
+
 } // namespace clang::dataflow
Index: clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h
===
--- clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h
+++ clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h
@@ -448,6 +448,12 @@
 return DACtx->arena().create(std::forward(args)...);
   }
 
+  /// Returns a symbolic integer value that models an integer literal equal to
+  /// `Value`
+  IntegerValue &getIntLiteralValue(llvm::APInt Value) const {
+return DACtx->arena().makeIntLiteral(Value);
+  }
+
   /// Returns a symbolic boolean value that models a boolean literal equal to
   /// `Value`
   AtomicBoolValue &getBoolLiteralValue(bool Value) const {
Index: clang/include/clang/Analysis/FlowSensitive/Arena.h
===
--- clang/include/clang/Analysis/FlowSensitiv

[PATCH] D152472: [Clang][MS] Remove assertion on BaseOffset can't be smaller than Size.

2023-06-15 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu added a comment.

In D152472#4425713 , @thakis wrote:

> This is still breaking check-clang on windows: 
> http://45.33.8.238/win/79908/step_7.txt
>
> Please take a look and revert for now if it takes a while to fix.

Sorry, I thought I applied the fix, but that was on another machine. The 
actually fix is in 
https://reviews.llvm.org/rG9d910b1073198716f85e5a7e7e9c8fd1f24d4c60.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152472/new/

https://reviews.llvm.org/D152472

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


[clang] 9d910b1 - Fix test breakage in 879e88693338657aec092db749ddfcb582c65491.

2023-06-15 Thread Zequan Wu via cfe-commits

Author: Zequan Wu
Date: 2023-06-15T14:46:54-04:00
New Revision: 9d910b1073198716f85e5a7e7e9c8fd1f24d4c60

URL: 
https://github.com/llvm/llvm-project/commit/9d910b1073198716f85e5a7e7e9c8fd1f24d4c60
DIFF: 
https://github.com/llvm/llvm-project/commit/9d910b1073198716f85e5a7e7e9c8fd1f24d4c60.diff

LOG: Fix test breakage in 879e88693338657aec092db749ddfcb582c65491.

Added: 


Modified: 
clang/lib/Frontend/LayoutOverrideSource.cpp

Removed: 




diff  --git a/clang/lib/Frontend/LayoutOverrideSource.cpp 
b/clang/lib/Frontend/LayoutOverrideSource.cpp
index f09444deb8d38..f474d4fe8fdcb 100644
--- a/clang/lib/Frontend/LayoutOverrideSource.cpp
+++ b/clang/lib/Frontend/LayoutOverrideSource.cpp
@@ -152,30 +152,31 @@ LayoutOverrideSource::LayoutOverrideSource(StringRef 
Filename) {
   }
 }
 
-// Check for the base offsets.
-Pos = LineStr.find("BaseOffsets: [");
+// Check for the virtual base offsets.
+Pos = LineStr.find("VBaseOffsets: [");
 if (Pos != StringRef::npos) {
-  LineStr = LineStr.substr(Pos + strlen("BaseOffsets: ["));
+  LineStr = LineStr.substr(Pos + strlen("VBaseOffsets: ["));
   while (!LineStr.empty() && isDigit(LineStr[0])) {
 unsigned long long Offset = 0;
 if (parseUnsigned(LineStr, Offset))
-  CurrentLayout.BaseOffsets.push_back(CharUnits::fromQuantity(Offset));
+  
CurrentLayout.VBaseOffsets.push_back(CharUnits::fromQuantity(Offset));
 
 // Skip over this offset, the following comma, and any spaces.
 LineStr = LineStr.substr(1);
 while (!LineStr.empty() && isWhitespace(LineStr[0]))
   LineStr = LineStr.substr(1);
   }
+  continue;
 }
 
-// Check for the virtual base offsets.
-Pos = LineStr.find("VBaseOffsets: [");
+// Check for the base offsets.
+Pos = LineStr.find("BaseOffsets: [");
 if (Pos != StringRef::npos) {
-  LineStr = LineStr.substr(Pos + strlen("VBaseOffsets: ["));
+  LineStr = LineStr.substr(Pos + strlen("BaseOffsets: ["));
   while (!LineStr.empty() && isDigit(LineStr[0])) {
 unsigned long long Offset = 0;
 if (parseUnsigned(LineStr, Offset))
-  
CurrentLayout.VBaseOffsets.push_back(CharUnits::fromQuantity(Offset));
+  CurrentLayout.BaseOffsets.push_back(CharUnits::fromQuantity(Offset));
 
 // Skip over this offset, the following comma, and any spaces.
 LineStr = LineStr.substr(1);



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


[PATCH] D132819: [RISCV] Add MC support of RISCV zcmp Extension

2023-06-15 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added inline comments.
Herald added a subscriber: wangpc.



Comment at: llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp:2442
+OperandMatchResultTy RISCVAsmParser::parseZcmpSpimm(OperandVector &Operands) {
+  if (getLexer().is(AsmToken::Minus))
+getLexer().Lex();

Ignoring `AsmToken::Minus`  looks suspicious.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132819/new/

https://reviews.llvm.org/D132819

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


[PATCH] D152986: [clang] Allow 'nomerge' attribute for function pointers

2023-06-15 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment.

The purpose of the attribute is really limited to preserving source location 
information on instructions, and this isn't really a supported usage. The BPF 
backend and verifier needs to learn to tolerate valid LLVM transforms if it 
wants to be a real LLVM backend. Of course, you can do what you like.

Considered in the context of the original use case, I think it's reasonable to 
allow the attribute on function pointers for the same reasons we allow it on 
function declarations. It makes it easy to work the attribute onto the direct 
call sites of the function without modifying tons of source code. However, I'd 
like to see clearer documentation on the limitations.




Comment at: clang/include/clang/Basic/AttrDocs.td:551-555
 calls to the specified function from merging. It has no effect on indirect 
 calls.
+
+``nomerge`` attribute can be specified for pointers to functions, all
+calls done through such pointer would be protected from merging.

This statement of the attribute having "no effect on indirect calls" is 
slightly confusing now that we talk about function pointers immediately 
afterward. Can you please rework this a bit, and clarify that when applied to 
function pointers, the attribute only takes effect when the call target is 
directly the variable which carries the attribute? For example, this has no 
effect:
```
void (*fp)() __attribute__((nomerge));
void callit() {
  auto tmp = fp;
  tmp();
  (*fp)(); // I think TargetDecl will be null in the code, tell me if I'm wrong
}
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152986/new/

https://reviews.llvm.org/D152986

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


[PATCH] D152472: [Clang][MS] Remove assertion on BaseOffset can't be smaller than Size.

2023-06-15 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

This is still breaking check-clang on windows: 
http://45.33.8.238/win/79908/step_7.txt

Please take a look and revert for now if it takes a while to fix.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152472/new/

https://reviews.llvm.org/D152472

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


[PATCH] D153059: [-Wunsafe-buffer-usage][WIP] Group parameter fix-its

2023-06-15 Thread Ziqing Luo via Phabricator via cfe-commits
ziqingluo-90 created this revision.
ziqingluo-90 added reviewers: NoQ, t-rasmud, jkorous, malavikasamak.
Herald added a project: All.
ziqingluo-90 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

For a function `F` whose parameters need to be fixed,  we group fix-its of its' 
parameters together so that either all of the parameters get fixed or none of 
them gets fixed.

The reason for doing so is to avoid generating low-quality fix-its.   For 
example,

  void f(int * p, int * q) {
 int i = p[5];
 int j = q[5];
  }

We would like to fix both parameters `p` and `q` with `std::span`.  If we do 
not group them together, they will be fixed in two steps: 1) fixing `p` first; 
and then 2) fixing `q`.   Step 1 yields a new overload of `f`:

  void f(std::span p, int *q) {  ...  }
  [[unsafe_buffer_usage]] void f(int *p, int *q) {return f(std::span(p, <# size 
#>), q);}
  }

The new overload of `f` is, however, still an unsafe function.  Then we apply 
step 2 and have:

  void f(std::span p, std::span q) {  ...  }
  [[unsafe_buffer_usage]] void f(int *p, int *q) {return f(std::span(p, <# 
size #>), q);}
  [[unsafe_buffer_usage]] void f(std::span p, int *q) {return f(p, 
std::span(q, <# size #>));}

The "intermediate" overload `void f(std::span, int *)` stays there but 
usually is not useful.  If there are more than two parameters need to be fixed, 
 there will be more such useless "intermediate" overloads.

With this patch, `p` and `q` will be fixed together:  either selecting `p` or 
`q` to fix will result in a safe function `void f(std::span p, 
std::span q` in one step.

The implementation is based on this patch , 
which uses a directed graph to group variables that depend on each other.   To 
group parameters,  I explicitly add directed edges between all parameters that 
need fix so that they form a ring.   As being a ring in the directed graph, no 
such parameter will be missed regardless of where the search in the graph 
starts, as long as at least one such parameter is reachable.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D153059

Files:
  clang/lib/Analysis/UnsafeBufferUsage.cpp
  clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-multi-parm-span.cpp
  clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-parm-span.cpp
  clang/test/SemaCXX/warn-unsafe-buffer-usage.cpp

Index: clang/test/SemaCXX/warn-unsafe-buffer-usage.cpp
===
--- clang/test/SemaCXX/warn-unsafe-buffer-usage.cpp
+++ clang/test/SemaCXX/warn-unsafe-buffer-usage.cpp
@@ -36,7 +36,7 @@
 void * voidPtrCall(void);
 char * charPtrCall(void);
 
-void testArraySubscripts(int *p, int **pp) { // expected-note{{change type of 'pp' to 'std::span' to preserve bounds information}}
+void testArraySubscripts(int *p, int **pp) {
 // expected-warning@-1{{'p' is an unsafe pointer used for buffer access}}
 // expected-warning@-2{{'pp' is an unsafe pointer used for buffer access}}
   foo(p[1], // expected-note{{used in buffer access here}}
@@ -109,7 +109,6 @@
   sizeof(decltype(p[1])));  // no-warning
 }
 
-// expected-note@+1{{change type of 'a' to 'std::span' to preserve bounds information}}
 void testQualifiedParameters(const int * p, const int * const q, const int a[10], const int b[10][10]) {
   // expected-warning@-1{{'p' is an unsafe pointer used for buffer access}}
   // expected-warning@-2{{'q' is an unsafe pointer used for buffer access}}
Index: clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-parm-span.cpp
===
--- clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-parm-span.cpp
+++ clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-parm-span.cpp
@@ -29,8 +29,7 @@
   int tmp;
   tmp = p[5] + q[5];
 }
-// CHECK-DAG: fix-it:{{.*}}:{[[@LINE-1]]:2-[[@LINE-1]]:2}:"\n{{\[}}{{\[}}clang::unsafe_buffer_usage{{\]}}{{\]}}\nvoid twoParms(int *p, int * q) {return twoParms(std::span(p, <# size #>), q);}\n"
-// CHECK-DAG: fix-it:{{.*}}:{[[@LINE-2]]:2-[[@LINE-2]]:2}:"\n{{\[}}{{\[}}clang::unsafe_buffer_usage{{\]}}{{\]}}\nvoid twoParms(int *p, int * q) {return twoParms(p, std::span(q, <# size #>));}\n"
+// CHECK-DAG: fix-it:{{.*}}:{[[@LINE-1]]:2-[[@LINE-1]]:2}:"\n{{\[}}{{\[}}clang::unsafe_buffer_usage{{\]}}{{\]}}\nvoid twoParms(int *p, int * q) {return twoParms(std::span(p, <# size #>), std::span(q, <# size #>));}\n"
 
 void ptrToConst(const int * x) {
   // CHECK-DAG: fix-it:{{.*}}:{[[@LINE-1]]:17-[[@LINE-1]]:30}:"std::span x"
@@ -100,22 +99,30 @@
 // namned
   } NAMED_S;
 
+
   // FIXME: `decltype(ANON_S)` represents an unnamed type but it can
   // be referred as "`decltype(ANON_S)`", so the analysis should
   // fix-it.
-  void decltypeSpecifier(decltype(C) * p, decltype(ANON_S) * q, decltype(NAMED_S) * r,
- decltype(NAMED_S) ** rr) {
-// CHECK-DAG: fix-it:{{.*}}:{[[@LINE-2

[PATCH] D152977: [NFC] Fix potential dereferencing of null return value.

2023-06-15 Thread Sindhu Chittireddy via Phabricator via cfe-commits
schittir added inline comments.



Comment at: clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp:294-295
   // UntouchedAndPossiblyDestroyed or UnlockedAndPossiblyDestroyed.
-  assert(lstate->isUntouchedAndPossiblyDestroyed() ||
- lstate->isUnlockedAndPossiblyDestroyed());
+  assert(lstate && (lstate->isUntouchedAndPossiblyDestroyed() ||
+lstate->isUnlockedAndPossiblyDestroyed()));
 

steakhal wrote:
> schittir wrote:
> > steakhal wrote:
> > > 
> > Wouldn't it be better to do an with a comment, like below?  
> > ```
> > assert(lstate && "lstate should not be null");
> > ```
> As a Static Analyzer dev I don't think its necessary. StateRefs are 
> ubiquitous and here we probably know it cannot be null. And if it turns out 
> to be null we would get a segfault. So that sense I don't think its necessary.
> 
> 
> And speaking of a comment like "it should not be null" I think the segfault 
> would sort of imply that.
That makes sense! Thanks!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152977/new/

https://reviews.llvm.org/D152977

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


[PATCH] D153008: [RISCV] Allow slash-star comments in instruction operands

2023-06-15 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

You may add a test file beside `llvm/test/CodeGen/RISCV/inline-asm*`. I hope 
that this patch focuses on `getLexer().Lex()` instances that actually cause a 
problem.

Many `getLexer().Lex()` instances followed by `is(...)` form a pattern that can 
be rewritten in a better way. I'll check these instances and fix them.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153008/new/

https://reviews.llvm.org/D153008

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


[PATCH] D153058: [clang][CFG] Support construction of a weak topological ordering of the CFG.

2023-06-15 Thread Yitzhak Mandelbaum via Phabricator via cfe-commits
ymandel updated this revision to Diff 531843.
ymandel added a comment.

fix some comments.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153058/new/

https://reviews.llvm.org/D153058

Files:
  clang/include/clang/Analysis/Analyses/IntervalPartition.h
  clang/lib/Analysis/IntervalPartition.cpp
  clang/unittests/Analysis/IntervalPartitionTest.cpp

Index: clang/unittests/Analysis/IntervalPartitionTest.cpp
===
--- clang/unittests/Analysis/IntervalPartitionTest.cpp
+++ clang/unittests/Analysis/IntervalPartitionTest.cpp
@@ -8,13 +8,115 @@
 
 #include "clang/Analysis/Analyses/IntervalPartition.h"
 #include "CFGBuildResult.h"
+#include "clang/Analysis/CFG.h"
+#include "llvm/Support/raw_ostream.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
+#include 
+#include 
 
 namespace clang {
-namespace analysis {
+
+llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
+  const CFGInterval::IntervalData &D) {
+  OS << "Nodes{";
+  if (std::holds_alternative>(D)) {
+auto &BlockData = std::get>(D);
+for (const auto *B : BlockData.Nodes)
+  OS << B->getBlockID() << ", ";
+  } else {
+assert(std::holds_alternative>(D));
+auto &IntervalData = std::get>(D);
+for (const auto *B : IntervalData.Nodes)
+  OS << B->ID << ", ";
+  }
+  OS << "}";
+  return OS;
+}
+
+llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const CFGInterval &I) {
+  OS << "Interval{ID = " << I.ID << ", ";
+  OS << I.Data;
+  OS << ", Pre{";
+  for (const auto *P : I.Predecessors)
+OS << P->ID << ",";
+  OS << "}, Succ{";
+  for (const auto *P : I.Successors)
+OS << P->ID << ",";
+  OS << "}}\n";
+  return OS;
+}
+
+void PrintTo(const CFGInterval::IntervalData &D, std::ostream *OS) {
+  std::string Result;
+  llvm::raw_string_ostream StringOS(Result);
+  StringOS << D;
+  *OS << Result;
+}
+
+void PrintTo(const CFGInterval &I, std::ostream *OS) {
+  std::string Result;
+  llvm::raw_string_ostream StringOS(Result);
+  StringOS << I;
+  *OS << Result;
+}
+
 namespace {
 
+using ::clang::analysis::BuildCFG;
+using ::clang::analysis::BuildResult;
+using ::testing::ElementsAre;
+using ::testing::Field;
+using ::testing::IsEmpty;
+using ::testing::Optional;
+using ::testing::UnorderedElementsAre;
+
+MATCHER_P(BlockID, ID, "") { return arg->getBlockID == ID; }
+MATCHER_P(IntervalID, ID, "") { return arg->ID == ID; }
+
+template 
+auto BlockIDs(T... IDs) {
+  return UnorderedElementsAre(
+  ::testing::Property(&CFGBlock::getBlockID, IDs)...);
+}
+
+template 
+auto IntervalIDs(T... IDs) {
+  return UnorderedElementsAre(
+  ::testing::Field(&CFGInterval::ID, IDs)...);
+}
+
+MATCHER_P3(IsBlockInterval, ID, Preds, Succs, "") {
+  if (!std::holds_alternative>(arg.Data))
+return false;
+
+  return testing::Matches(ID)(arg.ID) &&
+ testing::Matches(Preds)(arg.Predecessors) &&
+ testing::Matches(Succs)(arg.Successors);
+}
+
+MATCHER_P4(IsBlockInterval, ID, Nodes, Preds, Succs, "") {
+  if (!std::holds_alternative>(arg.Data))
+return false;
+  auto &IntervalData = std::get>(arg.Data);
+
+  return testing::Matches(ID)(arg.ID) &&
+ testing::Matches(Nodes)(IntervalData.Nodes) &&
+ testing::Matches(Preds)(arg.Predecessors) &&
+ testing::Matches(Succs)(arg.Successors);
+}
+
+MATCHER_P4(IsNestedInterval, ID, Nodes, Preds, Succs, "") {
+  if (!std::holds_alternative>(arg.Data))
+return false;
+  auto &IntervalData = std::get>(arg.Data);
+
+  return testing::Matches(ID)(arg.ID) &&
+ testing::Matches(Nodes)(IntervalData.Nodes) &&
+ testing::Matches(Preds)(arg.Predecessors) &&
+ testing::Matches(Succs)(arg.Successors);
+}
+
 TEST(BuildInterval, PartitionSimpleOneInterval) {
 
   const char *Code = R"(void f() {
@@ -32,8 +134,8 @@
 
   auto &EntryBlock = cfg->getEntry();
 
-  CFGInterval I = buildInterval(EntryBlock);
-  EXPECT_EQ(I.Blocks.size(), 3u);
+  std::vector I = buildInterval(&EntryBlock);
+  EXPECT_EQ(I.size(), 3u);
 }
 
 TEST(BuildInterval, PartitionIfThenOneInterval) {
@@ -56,12 +158,10 @@
 
   auto &EntryBlock = cfg->getEntry();
 
-  CFGInterval I = buildInterval(EntryBlock);
-  EXPECT_EQ(I.Blocks.size(), 6u);
+  std::vector I = buildInterval(&EntryBlock);
+  EXPECT_EQ(I.size(), 6u);
 }
 
-using ::testing::UnorderedElementsAre;
-
 TEST(BuildInterval, PartitionWhileMultipleIntervals) {
 
   const char *Code = R"(void f() {
@@ -80,11 +180,11 @@
   CFGBlock *InitXBlock = *EntryBlock->succ_begin();
   CFGBlock *LoopHeadBlock = *InitXBlock->succ_begin();
 
-  CFGInterval I1 = buildInterval(*EntryBlock);
-  EXPECT_THAT(I1.Blocks, UnorderedElementsAre(EntryBlock, InitXBlock));
+  std::vector I1 = buildInterval(EntryBlock);
+  EXPECT_THAT(I1, UnorderedElementsAre(EntryBlock, InitXBlock));
 
-  CFGInterval I2 = buildInterval(*LoopHeadBlock);
-  EXPECT_EQ(I2.Blocks.size(), 5u);
+  std::vector I2 = buildInterval(LoopHead

[PATCH] D153058: [clang][CFG] Support construction of a weak topological ordering of the CFG.

2023-06-15 Thread Yitzhak Mandelbaum via Phabricator via cfe-commits
ymandel created this revision.
ymandel added reviewers: xazax.hun, gribozavr.
Herald added a reviewer: NoQ.
Herald added a project: All.
ymandel requested review of this revision.
Herald added a project: clang.

This patch adds support for building a weak topological ordering of the CFG
blocks, based on a limit flow graph constructed via (repeated) interval
partitioning of the CFG.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D153058

Files:
  clang/include/clang/Analysis/Analyses/IntervalPartition.h
  clang/lib/Analysis/IntervalPartition.cpp
  clang/unittests/Analysis/IntervalPartitionTest.cpp

Index: clang/unittests/Analysis/IntervalPartitionTest.cpp
===
--- clang/unittests/Analysis/IntervalPartitionTest.cpp
+++ clang/unittests/Analysis/IntervalPartitionTest.cpp
@@ -8,13 +8,115 @@
 
 #include "clang/Analysis/Analyses/IntervalPartition.h"
 #include "CFGBuildResult.h"
+#include "clang/Analysis/CFG.h"
+#include "llvm/Support/raw_ostream.h"
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
+#include 
+#include 
 
 namespace clang {
-namespace analysis {
+
+llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
+  const CFGInterval::IntervalData &D) {
+  OS << "Nodes{";
+  if (std::holds_alternative>(D)) {
+auto &BlockData = std::get>(D);
+for (const auto *B : BlockData.Nodes)
+  OS << B->getBlockID() << ", ";
+  } else {
+assert(std::holds_alternative>(D));
+auto &IntervalData = std::get>(D);
+for (const auto *B : IntervalData.Nodes)
+  OS << B->ID << ", ";
+  }
+  OS << "}";
+  return OS;
+}
+
+llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const CFGInterval &I) {
+  OS << "Interval{ID = " << I.ID << ", ";
+  OS << I.Data;
+  OS << ", Pre{";
+  for (const auto *P : I.Predecessors)
+OS << P->ID << ",";
+  OS << "}, Succ{";
+  for (const auto *P : I.Successors)
+OS << P->ID << ",";
+  OS << "}}\n";
+  return OS;
+}
+
+void PrintTo(const CFGInterval::IntervalData &D, std::ostream *OS) {
+  std::string Result;
+  llvm::raw_string_ostream StringOS(Result);
+  StringOS << D;
+  *OS << Result;
+}
+
+void PrintTo(const CFGInterval &I, std::ostream *OS) {
+  std::string Result;
+  llvm::raw_string_ostream StringOS(Result);
+  StringOS << I;
+  *OS << Result;
+}
+
 namespace {
 
+using ::clang::analysis::BuildCFG;
+using ::clang::analysis::BuildResult;
+using ::testing::ElementsAre;
+using ::testing::Field;
+using ::testing::IsEmpty;
+using ::testing::Optional;
+using ::testing::UnorderedElementsAre;
+
+MATCHER_P(BlockID, ID, "") { return arg->getBlockID == ID; }
+MATCHER_P(IntervalID, ID, "") { return arg->ID == ID; }
+
+template 
+auto BlockIDs(T... IDs) {
+  return UnorderedElementsAre(
+  ::testing::Property(&CFGBlock::getBlockID, IDs)...);
+}
+
+template 
+auto IntervalIDs(T... IDs) {
+  return UnorderedElementsAre(
+  ::testing::Field(&CFGInterval::ID, IDs)...);
+}
+
+MATCHER_P3(IsBlockInterval, ID, Preds, Succs, "") {
+  if (!std::holds_alternative>(arg.Data))
+return false;
+
+  return testing::Matches(ID)(arg.ID) &&
+ testing::Matches(Preds)(arg.Predecessors) &&
+ testing::Matches(Succs)(arg.Successors);
+}
+
+MATCHER_P4(IsBlockInterval, ID, Nodes, Preds, Succs, "") {
+  if (!std::holds_alternative>(arg.Data))
+return false;
+  auto &IntervalData = std::get>(arg.Data);
+
+  return testing::Matches(ID)(arg.ID) &&
+ testing::Matches(Nodes)(IntervalData.Nodes) &&
+ testing::Matches(Preds)(arg.Predecessors) &&
+ testing::Matches(Succs)(arg.Successors);
+}
+
+MATCHER_P4(IsNestedInterval, ID, Nodes, Preds, Succs, "") {
+  if (!std::holds_alternative>(arg.Data))
+return false;
+  auto &IntervalData = std::get>(arg.Data);
+
+  return testing::Matches(ID)(arg.ID) &&
+ testing::Matches(Nodes)(IntervalData.Nodes) &&
+ testing::Matches(Preds)(arg.Predecessors) &&
+ testing::Matches(Succs)(arg.Successors);
+}
+
 TEST(BuildInterval, PartitionSimpleOneInterval) {
 
   const char *Code = R"(void f() {
@@ -32,8 +134,8 @@
 
   auto &EntryBlock = cfg->getEntry();
 
-  CFGInterval I = buildInterval(EntryBlock);
-  EXPECT_EQ(I.Blocks.size(), 3u);
+  std::vector I = buildInterval(&EntryBlock);
+  EXPECT_EQ(I.size(), 3u);
 }
 
 TEST(BuildInterval, PartitionIfThenOneInterval) {
@@ -56,12 +158,10 @@
 
   auto &EntryBlock = cfg->getEntry();
 
-  CFGInterval I = buildInterval(EntryBlock);
-  EXPECT_EQ(I.Blocks.size(), 6u);
+  std::vector I = buildInterval(&EntryBlock);
+  EXPECT_EQ(I.size(), 6u);
 }
 
-using ::testing::UnorderedElementsAre;
-
 TEST(BuildInterval, PartitionWhileMultipleIntervals) {
 
   const char *Code = R"(void f() {
@@ -80,11 +180,11 @@
   CFGBlock *InitXBlock = *EntryBlock->succ_begin();
   CFGBlock *LoopHeadBlock = *InitXBlock->succ_begin();
 
-  CFGInterval I1 = buildInterval(*EntryBlock);
-  EXPECT_THAT(I1.Blocks, UnorderedElementsAre(EntryBlock, InitXBlock));
+  std::vector I1

[PATCH] D152977: [NFC] Fix potential dereferencing of null return value.

2023-06-15 Thread Balázs Benics via Phabricator via cfe-commits
steakhal accepted this revision.
steakhal added a comment.

Looks good. Thanks!




Comment at: clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp:294-295
   // UntouchedAndPossiblyDestroyed or UnlockedAndPossiblyDestroyed.
-  assert(lstate->isUntouchedAndPossiblyDestroyed() ||
- lstate->isUnlockedAndPossiblyDestroyed());
+  assert(lstate && (lstate->isUntouchedAndPossiblyDestroyed() ||
+lstate->isUnlockedAndPossiblyDestroyed()));
 

schittir wrote:
> steakhal wrote:
> > 
> Wouldn't it be better to do an with a comment, like below?  
> ```
> assert(lstate && "lstate should not be null");
> ```
As a Static Analyzer dev I don't think its necessary. StateRefs are ubiquitous 
and here we probably know it cannot be null. And if it turns out to be null we 
would get a segfault. So that sense I don't think its necessary.


And speaking of a comment like "it should not be null" I think the segfault 
would sort of imply that.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152977/new/

https://reviews.llvm.org/D152977

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


[PATCH] D152977: [NFC] Fix potential dereferencing of null return value.

2023-06-15 Thread Sindhu Chittireddy via Phabricator via cfe-commits
schittir added inline comments.



Comment at: clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp:294-295
   // UntouchedAndPossiblyDestroyed or UnlockedAndPossiblyDestroyed.
-  assert(lstate->isUntouchedAndPossiblyDestroyed() ||
- lstate->isUnlockedAndPossiblyDestroyed());
+  assert(lstate && (lstate->isUntouchedAndPossiblyDestroyed() ||
+lstate->isUnlockedAndPossiblyDestroyed()));
 

steakhal wrote:
> 
Wouldn't it be better to do an with a comment, like below?  
```
assert(lstate && "lstate should not be null");
```


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152977/new/

https://reviews.llvm.org/D152977

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


[PATCH] D152139: [6/6][Clang][RISCV] Replace indexed segment store with tuple type interfaces

2023-06-15 Thread Yueh-Ting (eop) Chen via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1de5de4b7300: [6/6][Clang][RISCV] Replace indexed segment 
store with tuple type interfaces (authored by eopXD).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152139/new/

https://reviews.llvm.org/D152139

Files:
  clang/include/clang/Basic/riscv_vector.td
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg2ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg2ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg2ei32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg2ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg2ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg3ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg3ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg3ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg3ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg4ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg4ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg4ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg4ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg5ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg5ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg5ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg5ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg6ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg6ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg6ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg6ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg7ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg7ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg7ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg7ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg8ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg8ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg8ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsoxseg8ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg2ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg2ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg2ei32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg2ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg2ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg3ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg3ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg3ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg3ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg4ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg4ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg4ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg4ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg5ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg5ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg5ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg5ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsuxseg6e

[PATCH] D152138: [5/6][Clang][RISCV] Replace indexed segment load with tuple type interfaces

2023-06-15 Thread Yueh-Ting (eop) Chen via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc8447dd94422: [5/6][Clang][RISCV] Replace indexed segment 
load with tuple type interfaces (authored by eopXD).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152138/new/

https://reviews.llvm.org/D152138

Files:
  clang/include/clang/Basic/riscv_vector.td
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg2ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg2ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg2ei32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg2ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg2ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg3ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg3ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg3ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg3ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg4ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg4ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg4ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg4ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg5ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg5ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg5ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg5ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg6ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg6ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg6ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg6ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg7ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg7ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg7ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg7ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg8ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg8ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg8ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vloxseg8ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg2ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg2ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg2ei32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg2ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg2ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg3ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg3ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg3ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg3ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg4ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg4ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg4ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg4ei8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg5ei16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg5ei32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg5ei64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vluxseg5ei8.c
  
clang/test/CodeGen/RISCV/rvv-intri

[PATCH] D152977: [NFC] Fix potential dereferencing of null return value.

2023-06-15 Thread Sindhu Chittireddy via Phabricator via cfe-commits
schittir added inline comments.



Comment at: clang/lib/Frontend/FrontendActions.cpp:461
 
+assert(NamedCtx, "NamedCtx cannot be null");
+

aaron.ballman wrote:
> This doesn't build. ;-)
Thanks for the catch. Something was wrong with my workspace build setup, and 
didn't diagnose this at all! I changed this in the new patch. 


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152977/new/

https://reviews.llvm.org/D152977

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


[PATCH] D152977: [NFC] Fix potential dereferencing of null return value.

2023-06-15 Thread Sindhu Chittireddy via Phabricator via cfe-commits
schittir updated this revision to Diff 531824.
schittir marked an inline comment as done.
schittir added a comment.

Fix the assert causing build failure and address another review comment.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152977/new/

https://reviews.llvm.org/D152977

Files:
  clang/lib/AST/ASTContext.cpp
  clang/lib/Frontend/FrontendActions.cpp
  clang/lib/Sema/SemaType.cpp
  clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
  clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp


Index: clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
===
--- clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
@@ -291,6 +291,7 @@
   // Existence in DestroyRetVal ensures existence in LockMap.
   // Existence in Destroyed also ensures that the lock state for lockR is 
either
   // UntouchedAndPossiblyDestroyed or UnlockedAndPossiblyDestroyed.
+  assert(lstate);
   assert(lstate->isUntouchedAndPossiblyDestroyed() ||
  lstate->isUnlockedAndPossiblyDestroyed());
 
Index: clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
===
--- clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
+++ clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
@@ -321,7 +321,9 @@
   if (!IvarRegion)
 return nullptr;
 
-  return IvarRegion->getSymbolicBase()->getSymbol();
+  const SymbolicRegion *SR = IvarRegion->getSymbolicBase();
+  assert(SR && "Symbolic base should not be nullptr");
+  return SR->getSymbol();
 }
 
 /// If we are in -dealloc or -dealloc is on the stack, handle the call if it is
Index: clang/lib/Sema/SemaType.cpp
===
--- clang/lib/Sema/SemaType.cpp
+++ clang/lib/Sema/SemaType.cpp
@@ -2790,7 +2790,7 @@
 
   // Only support _BitInt elements with byte-sized power of 2 NumBits.
   if (T->isBitIntType()) {
-unsigned NumBits = T->getAs()->getNumBits();
+unsigned NumBits = T->castAs()->getNumBits();
 if (!llvm::isPowerOf2_32(NumBits) || NumBits < 8) {
   Diag(AttrLoc, diag::err_attribute_invalid_bitint_vector_type)
   << (NumBits < 8);
Index: clang/lib/Frontend/FrontendActions.cpp
===
--- clang/lib/Frontend/FrontendActions.cpp
+++ clang/lib/Frontend/FrontendActions.cpp
@@ -458,6 +458,8 @@
   return;
 }
 
+assert(NamedCtx && "NamedCtx cannot be null");
+
 if (const auto *Decl = dyn_cast(NamedTemplate)) {
   OS << "unnamed function parameter " << Decl->getFunctionScopeIndex()
  << " ";
Index: clang/lib/AST/ASTContext.cpp
===
--- clang/lib/AST/ASTContext.cpp
+++ clang/lib/AST/ASTContext.cpp
@@ -4141,8 +4141,8 @@
   assert(vecType->isBuiltinType() || vecType->isDependentType() ||
  (vecType->isBitIntType() &&
   // Only support _BitInt elements with byte-sized power of 2 NumBits.
-  llvm::isPowerOf2_32(vecType->getAs()->getNumBits()) &&
-  vecType->getAs()->getNumBits() >= 8));
+  llvm::isPowerOf2_32(vecType->castAs()->getNumBits()) &&
+  vecType->castAs()->getNumBits() >= 8));
 
   // Check if we've already instantiated a vector of this type.
   llvm::FoldingSetNodeID ID;


Index: clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
===
--- clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
@@ -291,6 +291,7 @@
   // Existence in DestroyRetVal ensures existence in LockMap.
   // Existence in Destroyed also ensures that the lock state for lockR is either
   // UntouchedAndPossiblyDestroyed or UnlockedAndPossiblyDestroyed.
+  assert(lstate);
   assert(lstate->isUntouchedAndPossiblyDestroyed() ||
  lstate->isUnlockedAndPossiblyDestroyed());
 
Index: clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
===
--- clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
+++ clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
@@ -321,7 +321,9 @@
   if (!IvarRegion)
 return nullptr;
 
-  return IvarRegion->getSymbolicBase()->getSymbol();
+  const SymbolicRegion *SR = IvarRegion->getSymbolicBase();
+  assert(SR && "Symbolic base should not be nullptr");
+  return SR->getSymbol();
 }
 
 /// If we are in -dealloc or -dealloc is on the stack, handle the call if it is
Index: clang/lib/Sema/SemaType.cpp
===
--- clang/lib/Sema/SemaType.cpp
+++ clang/lib/Sema/SemaType.cpp
@@ -2790,7 +2790,7 @@
 
   // Only support _BitInt elements with byte-sized power of 2 NumBits.
   if (T->isBitIntType()) {
-unsigned NumBits = T->getAs()->getNumBits();
+uns

[PATCH] D152137: [4/6][Clang][RISCV] Replace strided segment store with tuple type interfaces

2023-06-15 Thread Yueh-Ting (eop) Chen via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa30b1b4af11f: [4/6][Clang][RISCV] Replace strided segment 
store with tuple type interfaces (authored by eopXD).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152137/new/

https://reviews.llvm.org/D152137

Files:
  clang/include/clang/Basic/riscv_vector.td
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg2e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg2e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg2e32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg2e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg2e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg3e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg3e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg3e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg3e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg4e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg4e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg4e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg4e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg5e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg5e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg5e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg5e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg6e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg6e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg6e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg6e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg7e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg7e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg7e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg7e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg8e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg8e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg8e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vssseg8e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg2e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg2e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg2e32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg2e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg2e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg3e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg3e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg3e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg3e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg4e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg4e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg4e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg4e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg5e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg5e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg5e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg5e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg6e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vssseg6e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/

[PATCH] D152136: [3/6][Clang][RISCV] Replace strided segment load with tuple type interfaces

2023-06-15 Thread Yueh-Ting (eop) Chen via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4fc7afbfaf35: [3/6][Clang][RISCV] Replace strided segment 
load with tuple type interfaces (authored by eopXD).
Herald added a subscriber: wangpc.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152136/new/

https://reviews.llvm.org/D152136

Files:
  clang/include/clang/Basic/riscv_vector.td
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg2e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg2e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg2e32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg2e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg2e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg3e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg3e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg3e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg3e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg4e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg4e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg4e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg4e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg5e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg5e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg5e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg5e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg6e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg6e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg6e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg6e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg7e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg7e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg7e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg7e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg8e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg8e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg8e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlsseg8e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg2e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg2e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg2e32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg2e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg2e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg3e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg3e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg3e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg3e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg4e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg4e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg4e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg4e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg5e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg5e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg5e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg5e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg6e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vlsseg6e32.c
  
clang/test/CodeGen/RISCV/rvv-in

[PATCH] D152135: [2/6][Clang][RISCV] Replace unit-stride segment store with tuple type interfaces

2023-06-15 Thread Yueh-Ting (eop) Chen via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8720bdff91cc: [2/6][Clang][RISCV] Replace unit-stride 
segment store with tuple type interfaces (authored by eopXD).
Herald added a subscriber: wangpc.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152135/new/

https://reviews.llvm.org/D152135

Files:
  clang/include/clang/Basic/riscv_vector.td
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg2e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg2e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg2e32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg2e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg2e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg3e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg3e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg3e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg3e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg4e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg4e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg4e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg4e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg5e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg5e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg5e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg5e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg6e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg6e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg6e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg6e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg7e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg7e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg7e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg7e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg8e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg8e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg8e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vsseg8e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg2e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg2e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg2e32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg2e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg2e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg3e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg3e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg3e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg3e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg4e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg4e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg4e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg4e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg5e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg5e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg5e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg5e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg6e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vsseg6e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloade

[PATCH] D152070: [2/11][Clang][RISCV] Expand all variants of RVV intrinsic tuple types

2023-06-15 Thread Roger Ferrer Ibanez via Phabricator via cfe-commits
rogfer01 added a comment.

>> Can you check if clang crashes for you?
>
> I am seeing messages related to builtin type, but they do not seem related to 
> RVV builtin types.
>
>   $ touch t.c
>   $ clang -cc1 -triple riscv64 -w -emit-pch -o test.pch t.c
>   $ clang -cc1 -triple riscv64 -w -x c -include-pch test.pch -ast-dump-all 
> /dev/null
>   TranslationUnitDecl 0x60f3f88 <>  
> 
>   |-TypedefDecl 0x60f4b78 <>  implicit __int128_t 
> '__int128'
>   | `-BuiltinType 0x60f4520 '__int128'
>   |-TypedefDecl 0x60f4be8 <>  implicit 
> __uint128_t 'unsigned __int128'
>   | `-BuiltinType 0x60f4540 'unsigned __int128'
>   |-TypedefDecl 0x60f4ae8 <>  implicit 
> __NSConstantString 'struct __NSConstantString_tag'
>   | `-RecordType 0x60f48c0 'struct __NSConstantString_tag' imported
>   |   `-Record 0x60f4828 '__NSConstantString_tag'
>   `-TypedefDecl 0x60f4c58 <>  implicit 
> __builtin_va_list 'void *'
> `-PointerType 0x60f47a0 'void *'
>   `-BuiltinType 0x60f3fe0 'void'

Thanks @eopXD.

What I've seen is that the tst stops crashing for me if I disable all the types 
starting from line 218 in file `clang/include/clang/Basic/RISCVVTypes.def`.

When it doesn't crash, in my case all the registered RVV types are shown in the 
output

  TranslationUnitDecl 0x14647eb8 <>  

  |-TypedefDecl 0x14649e00 <>  implicit __int128_t 
'__int128'
  | `-BuiltinType 0x14648480 '__int128'
  |-TypedefDecl 0x14649e70 <>  implicit __uint128_t 
'unsigned __int128'
  | `-BuiltinType 0x146484a0 'unsigned __int128'
  |-TypedefDecl 0x14649d68 <>  implicit 
__NSConstantString 'struct __NSConstantString_tag'
  | `-RecordType 0x14649b40 'struct __NSConstantString_tag' imported
  |   `-Record 0x14649aa0 '__NSConstantString_tag'
  |-TypedefDecl 0x14649ed0 <>  imported implicit 
__rvv_int8mf8_t '__rvv_int8mf8_t'
  | `-BuiltinType 0x14648640 '__rvv_int8mf8_t'
  |-TypedefDecl 0x14649f58 <>  imported implicit 
__rvv_int8mf4_t '__rvv_int8mf4_t'
  | `-BuiltinType 0x14648660 '__rvv_int8mf4_t'
  |-TypedefDecl 0x14649fe0 <>  imported implicit 
__rvv_int8mf2_t '__rvv_int8mf2_t'
  | `-BuiltinType 0x14648680 '__rvv_int8mf2_t'
  |-TypedefDecl 0x1464a068 <>  imported implicit 
__rvv_int8m1_t '__rvv_int8m1_t'
  | `-BuiltinType 0x146486a0 '__rvv_int8m1_t'
  |-TypedefDecl 0x1464a0f0 <>  imported implicit 
__rvv_int8m2_t '__rvv_int8m2_t'
  | `-BuiltinType 0x146486c0 '__rvv_int8m2_t'
  |-TypedefDecl 0x1464a178 <>  imported implicit 
__rvv_int8m4_t '__rvv_int8m4_t'
  …

Curious that you don't observe this. I'll keep investigating.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152070/new/

https://reviews.llvm.org/D152070

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


[PATCH] D152134: [1/6][Clang][RISCV] Replace unit-stride (fault-first) segment load with tuple type interfaces

2023-06-15 Thread Yueh-Ting (eop) Chen via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5a80ef3fde9c: [1/6][Clang][RISCV] Replace unit-stride 
(fault-first) segment load with tuple… (authored by eopXD).
Herald added a subscriber: wangpc.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152134/new/

https://reviews.llvm.org/D152134

Files:
  clang/include/clang/Basic/riscv_vector.td
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e16ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e32_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e32ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e32ff_tuple.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e64ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg2e8ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg3e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg3e16ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg3e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg3e32ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg3e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg3e64ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg3e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg3e8ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg4e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg4e16ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg4e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg4e32ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg4e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg4e64ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg4e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg4e8ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg5e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg5e16ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg5e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg5e32ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg5e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg5e64ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg5e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg5e8ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg6e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg6e16ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg6e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg6e32ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg6e64.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg6e64ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg6e8.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg6e8ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg7e16.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg7e16ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg7e32.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg7e32ff.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vlseg7e

[clang] b8ea03a - Revert "Reland "[DebugMetadata][DwarfDebug] Fix DWARF emisson of function-local imported entities (3/7)""

2023-06-15 Thread Vladislav Dzhidzhoev via cfe-commits

Author: Vladislav Dzhidzhoev
Date: 2023-06-15T19:36:36+02:00
New Revision: b8ea03a4be0123cbff958711ec6d89e1ddaa347a

URL: 
https://github.com/llvm/llvm-project/commit/b8ea03a4be0123cbff958711ec6d89e1ddaa347a
DIFF: 
https://github.com/llvm/llvm-project/commit/b8ea03a4be0123cbff958711ec6d89e1ddaa347a.diff

LOG: Revert "Reland "[DebugMetadata][DwarfDebug] Fix DWARF emisson of 
function-local imported entities (3/7)""

This reverts commit fcc3981626821addc6c77b98006d02030b8ceb7f,
since Bitcode-upgrading code doesn't seem to be deterministic.

Added: 


Modified: 
clang/test/CodeGenCXX/debug-info-namespace.cpp
llvm/include/llvm/IR/DIBuilder.h
llvm/lib/Bitcode/Reader/MetadataLoader.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
llvm/lib/CodeGen/AsmPrinter/DwarfFile.h
llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
llvm/lib/IR/DIBuilder.cpp
llvm/lib/IR/Verifier.cpp
llvm/lib/Linker/IRMover.cpp
llvm/test/Bitcode/DIImportedEntity_backward.ll
llvm/test/Bitcode/DIModule-fortran-external-module.ll
llvm/test/CodeGen/Generic/DbgValueAggregate.ll
llvm/test/DebugInfo/Generic/imported-name-inlined.ll
llvm/test/DebugInfo/Generic/namespace.ll
llvm/test/DebugInfo/Generic/verifier-invalid-disubprogram.ll
llvm/test/DebugInfo/X86/dimodule-external-fortran.ll
llvm/test/DebugInfo/X86/dwarfdump-DIImportedEntity_elements.ll
llvm/test/DebugInfo/X86/fission-inline.ll
llvm/test/DebugInfo/X86/fission-local-import.ll
llvm/test/DebugInfo/X86/fission-no-inline-gsym.ll
llvm/test/DebugInfo/X86/lexical-block-file-inline.ll
llvm/test/DebugInfo/X86/namelist2.ll
llvm/test/DebugInfo/omit-empty.ll
llvm/test/Linker/pr26037.ll
llvm/test/ThinLTO/X86/debuginfo-cu-import.ll

Removed: 
llvm/test/Bitcode/upgrade-cu-locals.ll
llvm/test/Bitcode/upgrade-cu-locals.ll.bc
llvm/test/DebugInfo/Generic/import-inlined-declaration.ll
llvm/test/DebugInfo/Generic/split-dwarf-local-import.ll
llvm/test/DebugInfo/Generic/split-dwarf-local-import2.ll
llvm/test/DebugInfo/Generic/split-dwarf-local-import3.ll



diff  --git a/clang/test/CodeGenCXX/debug-info-namespace.cpp 
b/clang/test/CodeGenCXX/debug-info-namespace.cpp
index e3cf6507e1611..be88feda1112f 100644
--- a/clang/test/CodeGenCXX/debug-info-namespace.cpp
+++ b/clang/test/CodeGenCXX/debug-info-namespace.cpp
@@ -81,43 +81,44 @@ void C::c() {}
 // CHECK: !DINamespace(scope: null)
 // CHECK: [[CU:![0-9]+]] = distinct !DICompileUnit(
 // CHECK-SAME:imports: [[MODULES:![0-9]*]]
-// CHECK: [[MODULES]] = !{[[M1:![0-9]+]], [[M2:![0-9]+]], [[M3:![0-9]+]], 
[[M4:![0-9]+]]}
+// CHECK: [[MODULES]] = !{[[M1:![0-9]+]], [[M2:![0-9]+]], [[M3:![0-9]+]], 
[[M4:![0-9]+]], [[M5:![0-9]+]], [[M6:![0-9]+]], [[M7:![0-9]+]], [[M8:![0-9]+]], 
[[M9:![0-9]+]], [[M10:![0-9]+]], [[M11:![0-9]+]], [[M12:![0-9]+]], 
[[M13:![0-9]+]], [[M14:![0-9]+]], [[M15:![0-9]+]], [[M16:![0-9]+]], 
[[M17:![0-9]+]]
 // CHECK: [[M1]] = !DIImportedEntity(tag: DW_TAG_imported_module, scope: 
[[CTXT]], entity: [[NS]], file: [[FOOCPP]], line: 15)
+
 // CHECK: [[M2]] = !DIImportedEntity(tag: DW_TAG_imported_module, scope: 
[[CU]], entity: [[CTXT]],
 // CHECK: [[M3]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, name: 
"E", scope: [[CU]], entity: [[CTXT]], file: [[FOOCPP]], line: 19)
-// CHECK: [[M4]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: 
[[CTXT]], entity: [[I]]
-// CHECK: [[F1:![0-9]+]] = distinct !DISubprogram(name: "f1",{{.*}} line: 4
-// CHECK-SAME:   DISPFlagDefinition
-// CHECK: [[FUNC:![0-9]+]] = distinct !DISubprogram(name: "func",{{.*}} 
DISPFlagDefinition
-// CHECK-SAME: retainedNodes: 
[[FUNC_NODES:![0-9]*]]
-// CHECK: [[FUNC_NODES]] = !{[[M5:![0-9]+]], [[M6:![0-9]+]], [[M7:![0-9]+]], 
[[M8:![0-9]+]], [[M9:![0-9]+]], [[M10:![0-9]+]], [[M11:![0-9]+]], 
[[M12:![0-9]+]], [[M13:![0-9]+]], [[M14:![0-9]+]], [[M15:![0-9]+]], 
[[M16:![0-9]+]], [[M17:![0-9]+]]}
-// CHECK: [[M5]] = !DIImportedEntity(tag: DW_TAG_imported_module, scope: 
[[LEX2:![0-9]+]], entity: [[NS]], file: [[FOOCPP]], line: 23)
+// CHECK: [[M4]] = !DIImportedEntity(tag: DW_TAG_imported_module, scope: 
[[LEX2:![0-9]+]], entity: [[NS]], file: [[FOOCPP]], line: 23)
 // CHECK: [[LEX2]] = distinct !DILexicalBlock(scope: [[LEX1:![0-9]+]], file: 
[[FOOCPP]],
 // CHECK: [[LEX1]] = distinct !DILexicalBlock(scope: [[FUNC:![0-9]+]], file: 
[[FOOCPP]],
-// CHECK: [[M6]] = !DIImportedEntity(tag: DW_TAG_imported_module, scope: 
[[FUNC]], entity: [[CTXT]],
-// CHECK: [[M7]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: 
[[FUNC]], entity: [[FOO:![0-9]+]], file: [[FOOCPP]], line: 27)
+
+// CHECK: [[FUNC:!

[PATCH] D152889: [2/2][RISCV] Model vxrm control for vsadd, vsaddu, vssub, and vssubu

2023-06-15 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added a comment.

These instructions don't read vxrm why do they need to change?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152889/new/

https://reviews.llvm.org/D152889

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


[PATCH] D152889: [2/2][RISCV] Model vxrm control for vsadd, vsaddu, vssub, and vssubu

2023-06-15 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added a comment.

SemaChecking.cpp?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152889/new/

https://reviews.llvm.org/D152889

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


[PATCH] D152879: [1/2][RISCV] Model vxrm control for vsmul, vssra, vssrl, vnclip, and vnclipu

2023-06-15 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added a comment.
Herald added a subscriber: wangpc.

SemaChecking.cpp?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152879/new/

https://reviews.llvm.org/D152879

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


[PATCH] D152070: [2/11][Clang][RISCV] Expand all variants of RVV intrinsic tuple types

2023-06-15 Thread Yueh-Ting (eop) Chen via Phabricator via cfe-commits
eopXD added a comment.

In D152070#4425378 , @rogfer01 wrote:

> In D152070#4425358 , @eopXD wrote:
>
>> In D152070#4425318 , @rogfer01 
>> wrote:
>>
>>> In D152070#4421004 , 
>>> @DavidSpickett wrote:
>>>
 FYI after this change:

   Building CXX object 
 tools/lldb/sou...luginTypeSystemClang.dir/TypeSystemClang.cpp.o
   
 /home/david.spickett/llvm-project/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp:4843:13:
  warning: 225 enumeration values not handled in switch: 'RvvInt8mf8x2', 
 'RvvInt8mf8x3', 'RvvInt8mf8x4'... [-Wswitch]
   switch (llvm::cast(qual_type)->getKind()) {
   ^~~~

 lldb doesn't do anything with RVV yet, so you can likely just add all the 
 names to the existing block of RVV stuff that just `break`s at the end.
>>>
>>> This might be the cause to a crash I'm observing and that bisect pointed to.
>>>
>>> Reproducer:
>>>
>>>   $ touch t.c # empty file
>>>   $ clang -cc1 -triple riscv64 -w -emit-pch -o test.pch t.c
>>>   $ clang -cc1 -triple riscv64 -w -x c -include-pch test.pch -ast-dump-all 
>>> /dev/null
>>
>> Warning (and possibly the error you got) should be fixed now through 
>> https://reviews.llvm.org/D152922.
>
> Sorry @eopXD I confused everyone by linking the clang issue with that of lldb 
> and they are unrelated. Apologies.
>
> Can you check if clang crashes for you?

I am seeing messages related to builtin type, but they do not seem related to 
RVV builtin types.

  $ touch t.c
  $ clang -cc1 -triple riscv64 -w -emit-pch -o test.pch t.c
  $ clang -cc1 -triple riscv64 -w -x c -include-pch test.pch -ast-dump-all 
/dev/null
  TranslationUnitDecl 0x60f3f88 <>  
  |-TypedefDecl 0x60f4b78 <>  implicit __int128_t 
'__int128'
  | `-BuiltinType 0x60f4520 '__int128'
  |-TypedefDecl 0x60f4be8 <>  implicit __uint128_t 
'unsigned __int128'
  | `-BuiltinType 0x60f4540 'unsigned __int128'
  |-TypedefDecl 0x60f4ae8 <>  implicit 
__NSConstantString 'struct __NSConstantString_tag'
  | `-RecordType 0x60f48c0 'struct __NSConstantString_tag' imported
  |   `-Record 0x60f4828 '__NSConstantString_tag'
  `-TypedefDecl 0x60f4c58 <>  implicit 
__builtin_va_list 'void *'
`-PointerType 0x60f47a0 'void *'
  `-BuiltinType 0x60f3fe0 'void'


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152070/new/

https://reviews.llvm.org/D152070

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


[PATCH] D153008: [RISCV] Allow slash-star comments in instruction operands

2023-06-15 Thread Abel Bernabeu via Phabricator via cfe-commits
abel-bernabeu added a comment.

Thanks everyone, taking notes of all the comments for improving the test:

- Simplify the test (can be one instruction, no problem).
- Check at IR level
- Check for the comments to be placed in the output
- Do "arc diff" with one-line descriptions

Will update before tomorrow at mid-day (CET).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153008/new/

https://reviews.llvm.org/D153008

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


[clang] 046f624 - Fix NATVIS for some Clang types

2023-06-15 Thread Aaron Ballman via cfe-commits

Author: Aaron Ballman
Date: 2023-06-15T13:00:39-04:00
New Revision: 046f62492b4be8a1d043ae66d82ce2d8915bd10b

URL: 
https://github.com/llvm/llvm-project/commit/046f62492b4be8a1d043ae66d82ce2d8915bd10b
DIFF: 
https://github.com/llvm/llvm-project/commit/046f62492b4be8a1d043ae66d82ce2d8915bd10b.diff

LOG: Fix NATVIS for some Clang types

This updates the definition for ExplicitSpecifier and
DeclarationNameExtra.

Added: 


Modified: 
clang/utils/ClangVisualizers/clang.natvis

Removed: 




diff  --git a/clang/utils/ClangVisualizers/clang.natvis 
b/clang/utils/ClangVisualizers/clang.natvis
index ff949ce490d19..bbdce26225083 100644
--- a/clang/utils/ClangVisualizers/clang.natvis
+++ b/clang/utils/ClangVisualizers/clang.natvis
@@ -757,6 +757,7 @@ For later versions of Visual Studio, no setup is required-->
 
 C++ Literal operator
 C++ 
Using directive
+Objective-C MultiArg selector
 
{(clang::detail::DeclarationNameExtra::ExtraKind)ExtraKindOrNumArgs,en}{"
  ",sb}{*this,view(cpp)}
 
   (CXXDeductionGuideNameExtra *)this
@@ -912,10 +913,10 @@ For later versions of Visual Studio, no setup is 
required-->
 
   
   
-{"explicit 
",sb}
-
-explicit({ExplicitSpec,view(ptr)na})
-{ExplicitSpec,view(int)en}
+{"explicit ",sb}
+
+explicit({ExplicitSpec,view(ptr)na})
+{ExplicitSpec,view(int)en}
 {ExplicitSpec,view(int)en} : 
{ExplicitSpec,view(ptr)na}
   
   



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


[PATCH] D152070: [2/11][Clang][RISCV] Expand all variants of RVV intrinsic tuple types

2023-06-15 Thread Roger Ferrer Ibanez via Phabricator via cfe-commits
rogfer01 added a comment.

In D152070#4425358 , @eopXD wrote:

> In D152070#4425318 , @rogfer01 
> wrote:
>
>> In D152070#4421004 , 
>> @DavidSpickett wrote:
>>
>>> FYI after this change:
>>>
>>>   Building CXX object 
>>> tools/lldb/sou...luginTypeSystemClang.dir/TypeSystemClang.cpp.o
>>>   
>>> /home/david.spickett/llvm-project/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp:4843:13:
>>>  warning: 225 enumeration values not handled in switch: 'RvvInt8mf8x2', 
>>> 'RvvInt8mf8x3', 'RvvInt8mf8x4'... [-Wswitch]
>>>   switch (llvm::cast(qual_type)->getKind()) {
>>>   ^~~~
>>>
>>> lldb doesn't do anything with RVV yet, so you can likely just add all the 
>>> names to the existing block of RVV stuff that just `break`s at the end.
>>
>> This might be the cause to a crash I'm observing and that bisect pointed to.
>>
>> Reproducer:
>>
>>   $ touch t.c # empty file
>>   $ clang -cc1 -triple riscv64 -w -emit-pch -o test.pch t.c
>>   $ clang -cc1 -triple riscv64 -w -x c -include-pch test.pch -ast-dump-all 
>> /dev/null
>
> Warning (and possibly the error you got) should be fixed now through 
> https://reviews.llvm.org/D152922.

Sorry @eopXD I confused everyone by linking the clang issue with that of lldb 
and they are unrelated. Apologies.

Can you check if clang crashes for you?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152070/new/

https://reviews.llvm.org/D152070

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


[PATCH] D152070: [2/11][Clang][RISCV] Expand all variants of RVV intrinsic tuple types

2023-06-15 Thread Yueh-Ting (eop) Chen via Phabricator via cfe-commits
eopXD added a comment.

In D152070#4425318 , @rogfer01 wrote:

> In D152070#4421004 , @DavidSpickett 
> wrote:
>
>> FYI after this change:
>>
>>   Building CXX object 
>> tools/lldb/sou...luginTypeSystemClang.dir/TypeSystemClang.cpp.o
>>   
>> /home/david.spickett/llvm-project/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp:4843:13:
>>  warning: 225 enumeration values not handled in switch: 'RvvInt8mf8x2', 
>> 'RvvInt8mf8x3', 'RvvInt8mf8x4'... [-Wswitch]
>>   switch (llvm::cast(qual_type)->getKind()) {
>>   ^~~~
>>
>> lldb doesn't do anything with RVV yet, so you can likely just add all the 
>> names to the existing block of RVV stuff that just `break`s at the end.
>
> This might be the cause to a crash I'm observing and that bisect pointed to.
>
> Reproducer:
>
>   $ touch t.c # empty file
>   $ clang -cc1 -triple riscv64 -w -emit-pch -o test.pch t.c
>   $ clang -cc1 -triple riscv64 -w -x c -include-pch test.pch -ast-dump-all 
> /dev/null

Warning (and possibly the error you got) should be fixed now through 
https://reviews.llvm.org/D152922.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152070/new/

https://reviews.llvm.org/D152070

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


[PATCH] D153015: [clangd] Skip function parameter decls when evaluating variables on hover.

2023-06-15 Thread Haojian Wu via Phabricator via cfe-commits
hokein added inline comments.



Comment at: clang-tools-extra/clangd/Hover.cpp:663
+  const auto *Var = dyn_cast(D);
+  if (Var && !llvm::isa(Var)) {
 if (const Expr *Init = Var->getInit())

We're ignoring all `ParmVarDecl` cases, 

The crash here is for broken code. For the crash case, the AST node looks like 

```
`-ParmVarDecl 0x563b7cc853c0  col:14 invalid param 'Foo':'Foo' 
cinit
`-OpaqueValueExpr 0x563b7cc854a0  'Foo':'Foo'
```

One alternative is to exclude invalid `VarDecl`, then the Hover feature still 
keep working on valid `ParmVarDecl`.

```
if (const auto* Var = dyn_cast(D); Var && !Var->isInvalidDecl()) {
   ...
}
```



Comment at: clang-tools-extra/clangd/unittests/HoverTests.cpp:3726
+TEST(Hover, FunctionParameterDefaulValueNotEvaluated) {
+  Annotations T("void foo(int p^aram = 5);");
+  TestTU TU = TestTU::withCode(T.code());

VitaNuo wrote:
> hokein wrote:
> > I believe this case should trigger a crash, but I don't see the crash with 
> > a trunk-built clangd, do we miss something here?
> It crashes on invalid code. I've inspected two user workspaces:
> 1.
> 
> ```
> class Foo{};
> void foo(Foo param = nullptr);
> ```
> 
> 2.
> ```
> void foo(ClassName param = 
> functionReturningObjectOfSimilarSoundingButUnrelatedClass());
> ```
> 
> I guess `clangd` is not even expected to act soundly in the face of 
> non-compiling code. 
> But since these crashes are easy to get rid of, and evaluating parameters in 
> function declarations is pointless anyways, we can just avoid these crashes 
> at no extra cost. I cannot use non-compiling code in a hover test, though.
thanks for the clarification. That makes sense.

We can still use these broken code (the first one should be good enough) in the 
HoverTest, we need to add  a magic comment `/* error-ok */`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153015/new/

https://reviews.llvm.org/D153015

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


[PATCH] D152137: [4/6][Clang][RISCV] Replace strided segment store with tuple type interfaces

2023-06-15 Thread Roger Ferrer Ibanez via Phabricator via cfe-commits
rogfer01 accepted this revision.
rogfer01 added a comment.
This revision is now accepted and ready to land.
Herald added a subscriber: wangpc.

LGTM. Thanks @eopXD


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152137/new/

https://reviews.llvm.org/D152137

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


[PATCH] D152070: [2/11][Clang][RISCV] Expand all variants of RVV intrinsic tuple types

2023-06-15 Thread Roger Ferrer Ibanez via Phabricator via cfe-commits
rogfer01 added a comment.
Herald added a subscriber: wangpc.

In D152070#4421004 , @DavidSpickett 
wrote:

> FYI after this change:
>
>   Building CXX object 
> tools/lldb/sou...luginTypeSystemClang.dir/TypeSystemClang.cpp.o
>   
> /home/david.spickett/llvm-project/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp:4843:13:
>  warning: 225 enumeration values not handled in switch: 'RvvInt8mf8x2', 
> 'RvvInt8mf8x3', 'RvvInt8mf8x4'... [-Wswitch]
>   switch (llvm::cast(qual_type)->getKind()) {
>   ^~~~
>
> lldb doesn't do anything with RVV yet, so you can likely just add all the 
> names to the existing block of RVV stuff that just `break`s at the end.

This might be the cause to a crash I'm observing and that bisect pointed to.

Reproducer:

  $ touch t.c # empty file
  $ clang -cc1 -triple riscv64 -w -emit-pch -o test.pch t.c
  $ clang -cc1 -triple riscv64 -w -x c -include-pch test.pch -ast-dump-all 
/dev/null


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152070/new/

https://reviews.llvm.org/D152070

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


[PATCH] D152996: [RISCV][POC] Model frm control for vfadd

2023-06-15 Thread Yueh-Ting (eop) Chen via Phabricator via cfe-commits
eopXD added inline comments.



Comment at: llvm/lib/Target/RISCV/RISCVInsertReadWriteCSR.cpp:105
+
+BuildMI(MBB, MI, MI.getDebugLoc(), TII->get(RISCV::WriteFRMImm))
+.addImm(FRMImm);

craig.topper wrote:
> Don't we need to restore the original FRM value after the vector instruction?
Yes, will fix this in the next diff.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152996/new/

https://reviews.llvm.org/D152996

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


[PATCH] D151397: [3/3][RISCV][POC] Model vxrm in C intrinsics for RVV fixed-point instruction vaadd, vasub

2023-06-15 Thread Craig Topper via Phabricator via cfe-commits
craig.topper accepted this revision.
craig.topper added a comment.
This revision is now accepted and ready to land.
Herald added a subscriber: wangpc.

LGTM


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151397/new/

https://reviews.llvm.org/D151397

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


[PATCH] D149573: [Clang][C++23] Implement core language changes from P1467R9 extended floating-point types and standard names

2023-06-15 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In D149573#4418001 , @codemzs wrote:

> @tahonermann Gentle ping, please let me know if you have any questions.

FWIW, there are C++ standards meetings all week this week, and C standards 
meetings all next week (and into the following week), so @tahonermann (and 
other reviewers) might be slower to respond as a result.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149573/new/

https://reviews.llvm.org/D149573

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


  1   2   3   >