[clang] 8f4e6cf - [clang-format] Use utf-8 for JSON object load

2022-09-05 Thread Luke Drummond via cfe-commits

Author: Amy Wang
Date: 2022-09-05T15:40:47+01:00
New Revision: 8f4e6cfe73d803697470e817845d9b94c4530ca3

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

LOG: [clang-format] Use utf-8 for JSON object load

>From Python 3.6 and above, it should be able to automatically select a
decoding for json.loads. However, with a vim encoding that defaults
to utf-8, clang-format.py runs into the following error

TypeError: the JSON object must be str, not 'bytes'

This patch explicitly specifies utf-8 decoding for the header.

Reviewed by: ldrumm, sammcall

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

Added: 


Modified: 
clang/tools/clang-format/clang-format.py

Removed: 




diff  --git a/clang/tools/clang-format/clang-format.py 
b/clang/tools/clang-format/clang-format.py
index 76fedb6481474..5bc108bfc713b 100644
--- a/clang/tools/clang-format/clang-format.py
+++ b/clang/tools/clang-format/clang-format.py
@@ -10,9 +10,9 @@
 # imap  :py3f /clang-format.py
 #   endif
 #
-# The if-elseif-endif conditional should pick either the python3 or python2 
+# The if-elseif-endif conditional should pick either the python3 or python2
 # integration depending on your vim setup.
-# 
+#
 # The first mapping enables clang-format for NORMAL and VISUAL mode, the second
 # mapping adds support for INSERT mode. Change "C-I" to another binding if you
 # need clang-format on a 
diff erent key (C-I stands for Ctrl+i).
@@ -134,7 +134,7 @@ def main():
 )
   else:
 header, content = stdout.split(b'\n', 1)
-header = json.loads(header)
+header = json.loads(header.decode('utf-8'))
 # Strip off the trailing newline (added above).
 # This maintains trailing empty lines present in the buffer if
 # the -lines specification requests them to remain unchanged.



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


[clang] b781c7a - Fixed some wmma store builtins that had non-const src param

2023-10-19 Thread Luke Drummond via cfe-commits

Author: JackAKirk
Date: 2023-10-19T15:38:50+01:00
New Revision: b781c7ab574f54f54e1b32421398c723f3690f05

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

LOG: Fixed some wmma store builtins that had non-const src param

Now all wmma store builtins have src param marked const.

Reviewers: Tra

Added: 


Modified: 
clang/include/clang/Basic/BuiltinsNVPTX.def

Removed: 




diff  --git a/clang/include/clang/Basic/BuiltinsNVPTX.def 
b/clang/include/clang/Basic/BuiltinsNVPTX.def
index f645ad25cbd86da..d74a7d1e55dd281 100644
--- a/clang/include/clang/Basic/BuiltinsNVPTX.def
+++ b/clang/include/clang/Basic/BuiltinsNVPTX.def
@@ -920,22 +920,22 @@ TARGET_BUILTIN(__hmma_m16n16k16_ld_a, "vi*iC*UiIi", "", 
AND(SM_70,PTX60))
 TARGET_BUILTIN(__hmma_m16n16k16_ld_b, "vi*iC*UiIi", "", AND(SM_70,PTX60))
 TARGET_BUILTIN(__hmma_m16n16k16_ld_c_f16, "vi*iC*UiIi", "", AND(SM_70,PTX60))
 TARGET_BUILTIN(__hmma_m16n16k16_ld_c_f32, "vf*fC*UiIi", "", AND(SM_70,PTX60))
-TARGET_BUILTIN(__hmma_m16n16k16_st_c_f16, "vi*i*UiIi", "", AND(SM_70,PTX60))
-TARGET_BUILTIN(__hmma_m16n16k16_st_c_f32, "vf*f*UiIi", "", AND(SM_70,PTX60))
+TARGET_BUILTIN(__hmma_m16n16k16_st_c_f16, "vi*iC*UiIi", "", AND(SM_70,PTX60))
+TARGET_BUILTIN(__hmma_m16n16k16_st_c_f32, "vf*fC*UiIi", "", AND(SM_70,PTX60))
 
 TARGET_BUILTIN(__hmma_m32n8k16_ld_a, "vi*iC*UiIi", "", AND(SM_70,PTX61))
 TARGET_BUILTIN(__hmma_m32n8k16_ld_b, "vi*iC*UiIi", "", AND(SM_70,PTX61))
 TARGET_BUILTIN(__hmma_m32n8k16_ld_c_f16, "vi*iC*UiIi", "", AND(SM_70,PTX61))
 TARGET_BUILTIN(__hmma_m32n8k16_ld_c_f32, "vf*fC*UiIi", "", AND(SM_70,PTX61))
-TARGET_BUILTIN(__hmma_m32n8k16_st_c_f16, "vi*i*UiIi", "", AND(SM_70,PTX61))
-TARGET_BUILTIN(__hmma_m32n8k16_st_c_f32, "vf*f*UiIi", "", AND(SM_70,PTX61))
+TARGET_BUILTIN(__hmma_m32n8k16_st_c_f16, "vi*iC*UiIi", "", AND(SM_70,PTX61))
+TARGET_BUILTIN(__hmma_m32n8k16_st_c_f32, "vf*fC*UiIi", "", AND(SM_70,PTX61))
 
 TARGET_BUILTIN(__hmma_m8n32k16_ld_a, "vi*iC*UiIi", "", AND(SM_70,PTX61))
 TARGET_BUILTIN(__hmma_m8n32k16_ld_b, "vi*iC*UiIi", "", AND(SM_70,PTX61))
 TARGET_BUILTIN(__hmma_m8n32k16_ld_c_f16, "vi*iC*UiIi", "", AND(SM_70,PTX61))
 TARGET_BUILTIN(__hmma_m8n32k16_ld_c_f32, "vf*fC*UiIi", "", AND(SM_70,PTX61))
-TARGET_BUILTIN(__hmma_m8n32k16_st_c_f16, "vi*i*UiIi", "", AND(SM_70,PTX61))
-TARGET_BUILTIN(__hmma_m8n32k16_st_c_f32, "vf*f*UiIi", "", AND(SM_70,PTX61))
+TARGET_BUILTIN(__hmma_m8n32k16_st_c_f16, "vi*iC*UiIi", "", AND(SM_70,PTX61))
+TARGET_BUILTIN(__hmma_m8n32k16_st_c_f32, "vf*fC*UiIi", "", AND(SM_70,PTX61))
 
 TARGET_BUILTIN(__hmma_m16n16k16_mma_f16f16, "vi*iC*iC*iC*IiIi", "", 
AND(SM_70,PTX60))
 TARGET_BUILTIN(__hmma_m16n16k16_mma_f32f16, "vf*iC*iC*iC*IiIi", "", 
AND(SM_70,PTX60))



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


[clang] 108766f - Fix typos

2023-01-05 Thread Luke Drummond via cfe-commits

Author: Luke Drummond
Date: 2023-01-05T18:49:23Z
New Revision: 108766fc7ef83724ff4f66235bd561b217df0ff7

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

LOG: Fix typos

I found one typo of "implemnt", then some more.
s/implemnt/implement/g

Added: 


Modified: 
clang/lib/CodeGen/CGBuiltin.cpp
llvm/lib/CodeGen/MIRParser/MIParser.cpp
llvm/lib/MC/MCWin64EH.cpp
llvm/lib/Target/AArch64/MCTargetDesc/AArch64TargetStreamer.h
llvm/test/CodeGen/PowerPC/aix-alias.ll

Removed: 




diff  --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index b1e8517460ce8..0afa25da7aee3 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -7999,7 +7999,7 @@ Value *CodeGenFunction::EmitARMBuiltinExpr(unsigned 
BuiltinID,
 Value *Arg0 = EmitScalarExpr(E->getArg(0));
 Value *Arg1 = EmitScalarExpr(E->getArg(1));
 
-// crc32{c,}d intrinsics are implemnted as two calls to crc32{c,}w
+// crc32{c,}d intrinsics are implemented as two calls to crc32{c,}w
 // intrinsics, hence we need 
diff erent codegen for these cases.
 if (BuiltinID == clang::ARM::BI__builtin_arm_crc32d ||
 BuiltinID == clang::ARM::BI__builtin_arm_crc32cd) {

diff  --git a/llvm/lib/CodeGen/MIRParser/MIParser.cpp 
b/llvm/lib/CodeGen/MIRParser/MIParser.cpp
index 56c5c58142388..8b27edee45fe5 100644
--- a/llvm/lib/CodeGen/MIRParser/MIParser.cpp
+++ b/llvm/lib/CodeGen/MIRParser/MIParser.cpp
@@ -1847,7 +1847,7 @@ bool MIParser::parseIRConstant(StringRef::iterator Loc, 
const Constant *&C) {
   return false;
 }
 
-// See LLT implemntation for bit size limits.
+// See LLT implementation for bit size limits.
 static bool verifyScalarSize(uint64_t Size) {
   return Size != 0 && isUInt<16>(Size);
 }

diff  --git a/llvm/lib/MC/MCWin64EH.cpp b/llvm/lib/MC/MCWin64EH.cpp
index 4b20959ee5d6c..1a55722133ccd 100644
--- a/llvm/lib/MC/MCWin64EH.cpp
+++ b/llvm/lib/MC/MCWin64EH.cpp
@@ -1282,9 +1282,9 @@ static void ARM64EmitUnwindInfoForSegment(MCStreamer 
&streamer,
 // FIXME: We should be able to split unwind info into multiple sections.
 if (CodeWords > 0xFF || EpilogCount > 0x)
   report_fatal_error(
-  "SEH unwind data splitting is only implemnted for large functions, "
-  "cases of too many code words or too many epilogs will be done later"
-  );
+  "SEH unwind data splitting is only implemented for large functions, "
+  "cases of too many code words or too many epilogs will be done "
+  "later");
 uint32_t row2 = 0x0;
 row2 |= (CodeWords & 0xFF) << 16;
 row2 |= (EpilogCount & 0x);

diff  --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64TargetStreamer.h 
b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64TargetStreamer.h
index acb03f349e863..b3bce9960772e 100644
--- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64TargetStreamer.h
+++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64TargetStreamer.h
@@ -30,7 +30,7 @@ class AArch64TargetStreamer : public MCTargetStreamer {
   /// MCExpr that can be used to refer to the constant pool location.
   const MCExpr *addConstantPoolEntry(const MCExpr *, unsigned Size, SMLoc Loc);
 
-  /// Callback used to implemnt the .ltorg directive.
+  /// Callback used to implement the .ltorg directive.
   /// Emit contents of constant pool for the current section.
   void emitCurrentConstantPool();
 

diff  --git a/llvm/test/CodeGen/PowerPC/aix-alias.ll 
b/llvm/test/CodeGen/PowerPC/aix-alias.ll
index a3f6d87ca85ff..0ec2118beb7aa 100644
--- a/llvm/test/CodeGen/PowerPC/aix-alias.ll
+++ b/llvm/test/CodeGen/PowerPC/aix-alias.ll
@@ -1,5 +1,5 @@
 ; TODO: Add object generation test when visibility for object generation
-;   is implemnted.
+;   is implemented.
 
 ; RUN: llc -verify-machineinstrs -mtriple powerpc-ibm-aix-xcoff -mcpu=pwr4 \
 ; RUN: -mattr=-altivec -data-sections=false -xcoff-traceback-table=false < 
%s | \



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


[clang] e3fbede - [HIP] Add missing __hip_atomic_fetch_sub support

2023-05-30 Thread Luke Drummond via cfe-commits

Author: Luke Drummond
Date: 2023-05-30T22:22:43+01:00
New Revision: e3fbede7f3fd7693d5a15a8cfa0b62d9a4f84877

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

LOG: [HIP] Add missing __hip_atomic_fetch_sub support

The rest of the fetch/op intrinsics were added in e13246a2ec3 but sub
was conspicuous by its absence.

Reviewed By: yaxunl

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

Added: 


Modified: 
clang/include/clang/Basic/Builtins.def
clang/lib/AST/Expr.cpp
clang/lib/CodeGen/CGAtomic.cpp
clang/lib/Sema/SemaChecking.cpp
clang/test/CodeGenCUDA/atomic-ops.cu

Removed: 




diff  --git a/clang/include/clang/Basic/Builtins.def 
b/clang/include/clang/Basic/Builtins.def
index 15c69c2786476..e8cd200257c2a 100644
--- a/clang/include/clang/Basic/Builtins.def
+++ b/clang/include/clang/Basic/Builtins.def
@@ -910,6 +910,7 @@ ATOMIC_BUILTIN(__hip_atomic_compare_exchange_weak, "v.", 
"t")
 ATOMIC_BUILTIN(__hip_atomic_compare_exchange_strong, "v.", "t")
 ATOMIC_BUILTIN(__hip_atomic_exchange, "v.", "t")
 ATOMIC_BUILTIN(__hip_atomic_fetch_add, "v.", "t")
+ATOMIC_BUILTIN(__hip_atomic_fetch_sub, "v.", "t")
 ATOMIC_BUILTIN(__hip_atomic_fetch_and, "v.", "t")
 ATOMIC_BUILTIN(__hip_atomic_fetch_or, "v.", "t")
 ATOMIC_BUILTIN(__hip_atomic_fetch_xor, "v.", "t")

diff  --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index 958f4e9042319..c3c00932cee4e 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -4857,6 +4857,7 @@ unsigned AtomicExpr::getNumSubExprs(AtomicOp Op) {
 
   case AO__hip_atomic_exchange:
   case AO__hip_atomic_fetch_add:
+  case AO__hip_atomic_fetch_sub:
   case AO__hip_atomic_fetch_and:
   case AO__hip_atomic_fetch_or:
   case AO__hip_atomic_fetch_xor:

diff  --git a/clang/lib/CodeGen/CGAtomic.cpp b/clang/lib/CodeGen/CGAtomic.cpp
index 8ef95bb808468..0e7eb9723b49e 100644
--- a/clang/lib/CodeGen/CGAtomic.cpp
+++ b/clang/lib/CodeGen/CGAtomic.cpp
@@ -623,6 +623,7 @@ static void EmitAtomicOp(CodeGenFunction &CGF, AtomicExpr 
*E, Address Dest,
  : llvm::Instruction::Sub;
 [[fallthrough]];
   case AtomicExpr::AO__c11_atomic_fetch_sub:
+  case AtomicExpr::AO__hip_atomic_fetch_sub:
   case AtomicExpr::AO__opencl_atomic_fetch_sub:
   case AtomicExpr::AO__atomic_fetch_sub:
 Op = E->getValueType()->isFloatingType() ? llvm::AtomicRMWInst::FSub
@@ -897,6 +898,7 @@ RValue CodeGenFunction::EmitAtomicExpr(AtomicExpr *E) {
   case AtomicExpr::AO__c11_atomic_fetch_add:
   case AtomicExpr::AO__c11_atomic_fetch_sub:
   case AtomicExpr::AO__hip_atomic_fetch_add:
+  case AtomicExpr::AO__hip_atomic_fetch_sub:
   case AtomicExpr::AO__opencl_atomic_fetch_add:
   case AtomicExpr::AO__opencl_atomic_fetch_sub:
 if (MemTy->isPointerType()) {
@@ -1013,6 +1015,7 @@ RValue CodeGenFunction::EmitAtomicExpr(AtomicExpr *E) {
 case AtomicExpr::AO__c11_atomic_fetch_sub:
 case AtomicExpr::AO__opencl_atomic_fetch_sub:
 case AtomicExpr::AO__atomic_fetch_sub:
+case AtomicExpr::AO__hip_atomic_fetch_sub:
 case AtomicExpr::AO__c11_atomic_fetch_xor:
 case AtomicExpr::AO__opencl_atomic_fetch_xor:
 case AtomicExpr::AO__opencl_atomic_fetch_min:
@@ -1218,6 +1221,7 @@ RValue CodeGenFunction::EmitAtomicExpr(AtomicExpr *E) {
   [[fallthrough]];
 case AtomicExpr::AO__c11_atomic_fetch_sub:
 case AtomicExpr::AO__opencl_atomic_fetch_sub:
+case AtomicExpr::AO__hip_atomic_fetch_sub:
 case AtomicExpr::AO__atomic_fetch_sub:
   LibCallName = "__atomic_fetch_sub";
   AddDirectArgument(*this, Args, UseOptimizedLibcall, Val1.getPointer(),

diff  --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index d94e1d0beeaef..c8ebd51a4b3ef 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -6438,6 +6438,7 @@ ExprResult Sema::BuildAtomicExpr(SourceRange CallRange, 
SourceRange ExprRange,
 Form = Copy;
 break;
   case AtomicExpr::AO__hip_atomic_fetch_add:
+  case AtomicExpr::AO__hip_atomic_fetch_sub:
   case AtomicExpr::AO__hip_atomic_fetch_min:
   case AtomicExpr::AO__hip_atomic_fetch_max:
   case AtomicExpr::AO__c11_atomic_fetch_add:

diff  --git a/clang/test/CodeGenCUDA/atomic-ops.cu 
b/clang/test/CodeGenCUDA/atomic-ops.cu
index 13f4a015386cb..fbc042caa809f 100644
--- a/clang/test/CodeGenCUDA/atomic-ops.cu
+++ b/clang/test/CodeGenCUDA/atomic-ops.cu
@@ -6,6 +6,7 @@
 // CHECK: cmpxchg weak ptr {{%[0-9]+}}, i32 {{%[0-9]+}}, i32 {{%[0-9]+}} 
syncscope("singlethread-one-as") monotonic monotonic, align 4
 // CHECK: atomicrmw xchg ptr {{%[0-9]+}}, i32 {{%[0-9]+}} 
syncscope("singlethread-one-as")
 // CHECK: atomicrmw add ptr {{%[0-9]+}}, i32 {{%[0-9]+}} 
syncscope("singlethread-one-as")
+// CHECK: atomicrmw sub ptr {{%[0-9]+}}, i32 

r280240 - [clang-format-vim] Support vim linked against py3

2016-08-31 Thread Luke Drummond via cfe-commits
Author: ldrumm
Date: Wed Aug 31 08:36:36 2016
New Revision: 280240

URL: http://llvm.org/viewvc/llvm-project?rev=280240&view=rev
Log:
[clang-format-vim] Support vim linked against py3

clang-format.py previously only worked in vim compiled against python2.

This patch adds the necessary syntax changes to make this work with vim
linked against python3, which is now shipped by default for at least Ubuntu16 
and Arch.

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

Subscribers: cfe-commits

Modified:
cfe/trunk/tools/clang-format/clang-format.py

Modified: cfe/trunk/tools/clang-format/clang-format.py
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format/clang-format.py?rev=280240&r1=280239&r2=280240&view=diff
==
--- cfe/trunk/tools/clang-format/clang-format.py (original)
+++ cfe/trunk/tools/clang-format/clang-format.py Wed Aug 31 08:36:36 2016
@@ -25,6 +25,7 @@
 #
 # It operates on the current, potentially unsaved buffer and does not create
 # or save any files. To revert a formatting, just undo.
+from __future__ import print_function
 
 import difflib
 import json
@@ -49,6 +50,7 @@ if vim.eval('exists("g:clang_format_fall
 
 def main():
   # Get the current text.
+  encoding = vim.eval("&encoding")
   buf = vim.current.buffer
   text = '\n'.join(buf)
 
@@ -61,7 +63,7 @@ def main():
   # Determine the cursor position.
   cursor = int(vim.eval('line2byte(line("."))+col(".")')) - 2
   if cursor < 0:
-print 'Couldn\'t determine cursor position. Is your file empty?'
+print('Couldn\'t determine cursor position. Is your file empty?')
 return
 
   # Avoid flashing an ugly, ugly cmd prompt on Windows when invoking 
clang-format.
@@ -82,17 +84,19 @@ def main():
   p = subprocess.Popen(command,
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
stdin=subprocess.PIPE, startupinfo=startupinfo)
-  stdout, stderr = p.communicate(input=text)
+  stdout, stderr = p.communicate(input=text.encode(encoding))
 
   # If successful, replace buffer contents.
   if stderr:
-print stderr
+print(stderr)
 
   if not stdout:
-print ('No output from clang-format (crashed?).\n' +
-'Please report to bugs.llvm.org.')
+print(
+'No output from clang-format (crashed?).\n'
+'Please report to bugs.llvm.org.'
+)
   else:
-lines = stdout.split('\n')
+lines = stdout.decode(encoding).split('\n')
 output = json.loads(lines[0])
 lines = lines[1:]
 sequence = difflib.SequenceMatcher(None, vim.current.buffer, lines)
@@ -100,7 +104,7 @@ def main():
   if op[0] is not 'equal':
 vim.current.buffer[op[1]:op[2]] = lines[op[3]:op[4]]
 if output.get('IncompleteFormat'):
-  print 'clang-format: incomplete (syntax errors)'
+  print('clang-format: incomplete (syntax errors)')
 vim.command('goto %d' % (output['Cursor'] + 1))
 
 main()


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


[clang] 2921a09 - Make the argument -Xcuda-ptxas visible to the driver in cl-mode

2024-04-08 Thread Luke Drummond via cfe-commits

Author: Jefferson Le Quellec
Date: 2024-04-08T14:11:43+01:00
New Revision: 2921a0928c71f4ee652a2478283e47ab5ffebf58

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

LOG: Make the argument -Xcuda-ptxas visible to the driver in cl-mode

It has been noticed that the arguments are being passed twice to ptxas.
This also has been fixed by filtering out the arguments before appending
them to the new DAL created by CudaToolChain::TranslateArgs.

github:https://github.com/llvm/llvm-project/pull/86807

Added: 


Modified: 
clang/include/clang/Driver/Options.td
clang/lib/Driver/ToolChains/Cuda.cpp
clang/test/Driver/cuda-external-tools.cu

Removed: 




diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 827d9d7c0c18e4..f745e573eb2686 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -1003,7 +1003,8 @@ def : Joined<["-"], "Xclang=">, Group,
 def Xcuda_fatbinary : Separate<["-"], "Xcuda-fatbinary">,
   HelpText<"Pass  to fatbinary invocation">, MetaVarName<"">;
 def Xcuda_ptxas : Separate<["-"], "Xcuda-ptxas">,
-  HelpText<"Pass  to the ptxas assembler">, MetaVarName<"">;
+  HelpText<"Pass  to the ptxas assembler">, MetaVarName<"">,
+  Visibility<[ClangOption, CLOption]>;
 def Xopenmp_target : Separate<["-"], "Xopenmp-target">, 
Group,
   HelpText<"Pass  to the target offloading toolchain.">, 
MetaVarName<"">;
 def Xopenmp_target_EQ : JoinedAndSeparate<["-"], "Xopenmp-target=">, 
Group,

diff  --git a/clang/lib/Driver/ToolChains/Cuda.cpp 
b/clang/lib/Driver/ToolChains/Cuda.cpp
index 5f0b516e1a1a08..6634e6d818b33e 100644
--- a/clang/lib/Driver/ToolChains/Cuda.cpp
+++ b/clang/lib/Driver/ToolChains/Cuda.cpp
@@ -990,7 +990,10 @@ CudaToolChain::TranslateArgs(const 
llvm::opt::DerivedArgList &Args,
   }
 
   for (Arg *A : Args) {
-DAL->append(A);
+// Make sure flags are not duplicated.
+if (!llvm::is_contained(*DAL, A)) {
+  DAL->append(A);
+}
   }
 
   if (!BoundArch.empty()) {

diff  --git a/clang/test/Driver/cuda-external-tools.cu 
b/clang/test/Driver/cuda-external-tools.cu
index 946e144fce38fb..d9564d026b4faa 100644
--- a/clang/test/Driver/cuda-external-tools.cu
+++ b/clang/test/Driver/cuda-external-tools.cu
@@ -86,6 +86,12 @@
 // RUN:   -Xcuda-fatbinary -bar1 -Xcuda-ptxas -foo2 -Xcuda-fatbinary -bar2 %s 
2>&1 \
 // RUN: | FileCheck -check-prefixes=CHECK,SM35,PTXAS-EXTRA,FATBINARY-EXTRA %s
 
+// Check -Xcuda-ptxas with clang-cl
+// RUN: %clang_cl -### -c -Xcuda-ptxas -foo1 \
+// RUN:   --offload-arch=sm_35 --cuda-path=%S/Inputs/CUDA/usr/local/cuda \
+// RUN:   -Xcuda-ptxas -foo2 %s 2>&1 \
+// RUN: | FileCheck -check-prefixes=CHECK,SM35,PTXAS-EXTRA %s
+
 // MacOS spot-checks
 // RUN: %clang -### --target=x86_64-apple-macosx -O0 -c %s 2>&1 \
 // RUN:   --offload-arch=sm_35 --cuda-path=%S/Inputs/CUDA/usr/local/cuda \
@@ -140,6 +146,8 @@
 // CHECK-SAME: "[[PTXFILE]]"
 // PTXAS-EXTRA-SAME: "-foo1"
 // PTXAS-EXTRA-SAME: "-foo2"
+// CHECK-NOT: "-foo1"
+// CHECK-NOT: "-foo2"
 // RDC-SAME: "-c"
 // CHECK-NOT: "-c"
 



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


[clang] d285e54 - Delete old broken lit runner

2024-04-25 Thread Luke Drummond via cfe-commits

Author: Luke Drummond
Date: 2024-04-25T16:06:34+01:00
New Revision: d285e54320e9bc42ea91b28a59a831c58627217a

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

LOG: Delete old broken lit runner

Last updated before the monorepo was created, this lit wrapper can no
longer work. Since it's been broken for so long, I don't think anyone's
going to miss it.

Added: 


Modified: 


Removed: 
clang/test/TestRunner.sh



diff  --git a/clang/test/TestRunner.sh b/clang/test/TestRunner.sh
deleted file mode 100755
index f96d3d552d2ee6..00
--- a/clang/test/TestRunner.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh
-#
-# TestRunner.sh - Backward compatible utility for testing an individual file.
-
-# Find where this script is.
-Dir=$(dirname $(which $0))
-AbsDir=$(cd $Dir; pwd)
-
-# Find 'lit', assuming standard layout.
-lit=$AbsDir/../../../utils/lit/lit.py
-
-# Dispatch to lit.
-$lit "$@"



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


[clang] 440f6bd - [OpenCL][NFCI] Prefer CodeGenFunction::EmitRuntimeCall

2021-03-16 Thread Luke Drummond via cfe-commits

Author: Luke Drummond
Date: 2021-03-16T16:22:19Z
New Revision: 440f6bdf34f4ce3ac3435d650f5296dcc0102488

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

LOG: [OpenCL][NFCI] Prefer CodeGenFunction::EmitRuntimeCall

`CodeGenFunction::EmitRuntimeCall` automatically sets the right calling
convention for the callee so we can avoid setting it ourselves.

As requested in https://reviews.llvm.org/D98411

Reviewed by: anastasia
Differential Revision: https://reviews.llvm.org/D98705

Added: 


Modified: 
clang/lib/CodeGen/CodeGenModule.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CodeGenModule.cpp 
b/clang/lib/CodeGen/CodeGenModule.cpp
index 75854f69b110..f3a73f8783dc 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -6265,9 +6265,8 @@ CodeGenModule::createOpenCLIntToSamplerConversion(const 
Expr *E,
   llvm::Constant *C = ConstantEmitter(CGF).emitAbstract(E, E->getType());
   auto *SamplerT = 
getOpenCLRuntime().getSamplerType(E->getType().getTypePtr());
   auto *FTy = llvm::FunctionType::get(SamplerT, {C->getType()}, false);
-  auto *Call = CGF.Builder.CreateCall(
+  auto *Call = CGF.EmitRuntimeCall(
   CreateRuntimeFunction(FTy, "__translate_sampler_initializer"), {C});
-  Call->setCallingConv(Call->getCalledFunction()->getCallingConv());
   return Call;
 }
 



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


[clang] 6283d46 - Workaround build error for mingw-g++

2021-10-07 Thread Luke Drummond via cfe-commits

Author: Luke Drummond
Date: 2021-10-07T18:34:16+01:00
New Revision: 6283d468e28b35e2731dda1a9e0efcb3d9acf557

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

LOG: Workaround build error for mingw-g++

mingw-g++ does not correctly support the full `std::errc` namespace as
worded in the standard[1]. As such, we cannot reliably use all names
therein. This patch changes the use of
`std::errc::state_not_recoverable`, to use portable error codes from the
`llvm::errc` equivalent.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71444

Reviewed by v.g.vassilev
Differential Revision: https://reviews.llvm.org/D111315

Added: 


Modified: 
clang/lib/Interpreter/Interpreter.cpp

Removed: 




diff  --git a/clang/lib/Interpreter/Interpreter.cpp 
b/clang/lib/Interpreter/Interpreter.cpp
index 3e8d3884049ba..28c6c4f4e80f8 100644
--- a/clang/lib/Interpreter/Interpreter.cpp
+++ b/clang/lib/Interpreter/Interpreter.cpp
@@ -30,6 +30,7 @@
 #include "clang/Lex/PreprocessorOptions.h"
 
 #include "llvm/IR/Module.h"
+#include "llvm/Support/Errc.h"
 #include "llvm/Support/Host.h"
 
 using namespace clang;
@@ -47,14 +48,14 @@ GetCC1Arguments(DiagnosticsEngine *Diagnostics,
   // failed. Extract that job from the Compilation.
   const driver::JobList &Jobs = Compilation->getJobs();
   if (!Jobs.size() || !isa(*Jobs.begin()))
-return llvm::createStringError(std::errc::state_not_recoverable,
+return llvm::createStringError(llvm::errc::not_supported,
"Driver initialization failed. "
"Unable to create a driver job");
 
   // The one job we find should be to invoke clang again.
   const driver::Command *Cmd = cast(&(*Jobs.begin()));
   if (llvm::StringRef(Cmd->getCreator().getName()) != "clang")
-return llvm::createStringError(std::errc::state_not_recoverable,
+return llvm::createStringError(llvm::errc::not_supported,
"Driver initialization failed");
 
   return &Cmd->getArguments();
@@ -89,13 +90,13 @@ CreateCI(const llvm::opt::ArgStringList &Argv) {
   // Create the actual diagnostics engine.
   Clang->createDiagnostics();
   if (!Clang->hasDiagnostics())
-return llvm::createStringError(std::errc::state_not_recoverable,
+return llvm::createStringError(llvm::errc::not_supported,
"Initialization failed. "
"Unable to create diagnostics engine");
 
   DiagsBuffer->FlushDiagnostics(Clang->getDiagnostics());
   if (!Success)
-return llvm::createStringError(std::errc::state_not_recoverable,
+return llvm::createStringError(llvm::errc::not_supported,
"Initialization failed. "
"Unable to flush diagnostics");
 
@@ -106,7 +107,7 @@ CreateCI(const llvm::opt::ArgStringList &Argv) {
   Clang->setTarget(TargetInfo::CreateTargetInfo(
   Clang->getDiagnostics(), Clang->getInvocation().TargetOpts));
   if (!Clang->hasTarget())
-return llvm::createStringError(std::errc::state_not_recoverable,
+return llvm::createStringError(llvm::errc::not_supported,
"Initialization failed. "
"Target is missing");
 



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


[clang] e669bbb - Revert "Finally formalise our defacto line-ending policy"

2024-10-18 Thread Luke Drummond via cfe-commits

Author: Luke Drummond
Date: 2024-10-18T21:16:24+01:00
New Revision: e6697265a7d4d59bac2d3889194efa167ea8

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

LOG: Revert "Finally formalise our defacto line-ending policy"

This reverts commit dccebddb3b802c4c1fe287222e454b63f850f012.

Added: 


Modified: 
.gitattributes
llvm/docs/TestingGuide.rst

Removed: 
clang-tools-extra/clangd/test/.gitattributes
clang/test/.gitattributes
llvm/test/FileCheck/.gitattributes
llvm/test/tools/llvm-ar/Inputs/.gitattributes
llvm/utils/lit/tests/Inputs/shtest-shell/.gitattributes



diff  --git a/.gitattributes b/.gitattributes
index aced01d485c181..6b281f33f737db 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,10 +1,3 @@
-# Checkout as native, commit as LF except in specific circumstances
-* text=auto
-*.bat text eol=crlf
-*.rc text eol=crlf
-*.sln text eol=crlf
-*.natvis text eol=crlf
-
 libcxx/src/**/*.cpp merge=libcxx-reformat
 libcxx/include/**/*.h   merge=libcxx-reformat
 

diff  --git a/clang-tools-extra/clangd/test/.gitattributes 
b/clang-tools-extra/clangd/test/.gitattributes
deleted file mode 100644
index 20971adc2b5d03..00
--- a/clang-tools-extra/clangd/test/.gitattributes
+++ /dev/null
@@ -1,3 +0,0 @@
-input-mirror.test text eol=crlf
-too_large.test text eol=crlf
-protocol.test text eol=crlf

diff  --git a/clang/test/.gitattributes b/clang/test/.gitattributes
deleted file mode 100644
index 160fc6cf561751..00
--- a/clang/test/.gitattributes
+++ /dev/null
@@ -1,4 +0,0 @@
-FixIt/fixit-newline-style.c text eol=crlf
-Frontend/system-header-line-directive-ms-lineendings.c text eol=crlf
-Frontend/rewrite-includes-mixed-eol-crlf.* text eol=crlf
-clang/test/Frontend/rewrite-includes-mixed-eol-lf.h text eolf=lf

diff  --git a/llvm/docs/TestingGuide.rst b/llvm/docs/TestingGuide.rst
index 344a295226f6ae..08617933519fdb 100644
--- a/llvm/docs/TestingGuide.rst
+++ b/llvm/docs/TestingGuide.rst
@@ -360,12 +360,6 @@ Best practices for regression tests
 - Try to give values (including variables, blocks and functions) meaningful
   names, and avoid retaining complex names generated by the optimization
   pipeline (such as ``%foo.0.0.0.0.0.0``).
-- If your tests depend on specific input file encodings, beware of line-ending
-  issues across 
diff erent platforms, and in the project's history. Before you
-  commit tests that depend on explicit encodings, consider adding filetype or
-  specific line-ending annotations to a `<.gitattributes
-  https://git-scm.com/docs/gitattributes#_effects>`_ file in the appropriate
-  directory in the repository.
 
 Extra files
 ---

diff  --git a/llvm/test/FileCheck/.gitattributes 
b/llvm/test/FileCheck/.gitattributes
deleted file mode 100644
index ba27d7fad76d50..00
--- a/llvm/test/FileCheck/.gitattributes
+++ /dev/null
@@ -1 +0,0 @@
-dos-style-eol.txt text eol=crlf

diff  --git a/llvm/test/tools/llvm-ar/Inputs/.gitattributes 
b/llvm/test/tools/llvm-ar/Inputs/.gitattributes
deleted file mode 100644
index 6c8a26285daf7f..00
--- a/llvm/test/tools/llvm-ar/Inputs/.gitattributes
+++ /dev/null
@@ -1 +0,0 @@
-mri-crlf.mri text eol=crlf

diff  --git a/llvm/utils/lit/tests/Inputs/shtest-shell/.gitattributes 
b/llvm/utils/lit/tests/Inputs/shtest-shell/.gitattributes
deleted file mode 100644
index 2df17345df5b87..00
--- a/llvm/utils/lit/tests/Inputs/shtest-shell/.gitattributes
+++ /dev/null
@@ -1 +0,0 @@
-*.dos text eol=crlf



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


[clang-tools-extra] dccebdd - Finally formalise our defacto line-ending policy

2024-10-17 Thread Luke Drummond via cfe-commits

Author: Luke Drummond
Date: 2024-10-17T14:47:54+01:00
New Revision: dccebddb3b802c4c1fe287222e454b63f850f012

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

LOG: Finally formalise our defacto line-ending policy

Historically, we've not automatically enforced how git tracks line
endings, but there are many, many commits that "undo" unintended CRLFs
getting into history.

`git log --pretty=oneline --grep=CRLF` shows nearly 100 commits
involving reverts of CRLF making its way into the index and then
history. As far as I can tell, there are none the other way round except
for specific cases like `.bat` files or tests for parsers that need to
accept such sequences.

Of note, one of the earliest of those listed in that output is:

```
  commit 9795860250734e5c2a879546c534e35d9edd5944
  Author: NAKAMURA Takumi 
  Date:   Thu Feb 3 11:41:27 2011 +

  cmake/*: Add svn:eol-style=native and fix CRLF.

  llvm-svn: 124793
```

...which introduced such a defacto policy for subversion.

With old versions of git, it's been a bit of a crap-shoot whether
enforcing storing line endings in the history will upset checkouts on
machines where such line endings are the norm. Indeed many users have
enforced that git checks out the working copy according to a global or
per-user config via core crlf, or core autocrlf.

For ~8 years now[1], however, git has supported the ability to "do as
the Romans do" on checkout, but internally store subsets of text files
with line-endings specified via a system of patterns in the
`.gitattributes` file. Since we now have this ability, and we've been
specifying attributes for various binary files, I think it makes sense
to rid us of all that work converting things "back", and just let git
handle the local checkout. Thus the new toplevel policy here is

* text=auto

In simple terms this means "unless otherwise specified, convert all
files considered "text" files to LF in the project history, but check
them out as expected on the local machine. What is "expected on the
local machine" is dependent on configuration and default.

For those files in the repository that *do* need CRLF endings, I've
adopted a policy of `eol=crlf` which means that git will store them in
history with LF, but regardless of user config, they'll be checked out
in tree with CRLF.

Finally, existing files have been "corrected" in history via `git add
--renormalize .`

End users should *not* need to adjust their local git config or
workflow.

[1]: git 2.10 was released with fixed support for fine-grained
line-ending tracking that respects user-config *and* repo policy. This
can be considered the point at which git will respect both the user's
local working tree preference *and* the history as specified by the
maintainers. See
https://github.com/git/git/blob/master/Documentation/RelNotes/2.10.0.txt#L248
for the release note.

Added: 
clang-tools-extra/clangd/test/.gitattributes
clang/test/.gitattributes
llvm/test/FileCheck/.gitattributes
llvm/test/tools/llvm-ar/Inputs/.gitattributes
llvm/utils/lit/tests/Inputs/shtest-shell/.gitattributes

Modified: 
.gitattributes
llvm/docs/TestingGuide.rst

Removed: 




diff  --git a/.gitattributes b/.gitattributes
index 6b281f33f737db..aced01d485c181 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,3 +1,10 @@
+# Checkout as native, commit as LF except in specific circumstances
+* text=auto
+*.bat text eol=crlf
+*.rc text eol=crlf
+*.sln text eol=crlf
+*.natvis text eol=crlf
+
 libcxx/src/**/*.cpp merge=libcxx-reformat
 libcxx/include/**/*.h   merge=libcxx-reformat
 

diff  --git a/clang-tools-extra/clangd/test/.gitattributes 
b/clang-tools-extra/clangd/test/.gitattributes
new file mode 100644
index 00..20971adc2b5d03
--- /dev/null
+++ b/clang-tools-extra/clangd/test/.gitattributes
@@ -0,0 +1,3 @@
+input-mirror.test text eol=crlf
+too_large.test text eol=crlf
+protocol.test text eol=crlf

diff  --git a/clang/test/.gitattributes b/clang/test/.gitattributes
new file mode 100644
index 00..160fc6cf561751
--- /dev/null
+++ b/clang/test/.gitattributes
@@ -0,0 +1,4 @@
+FixIt/fixit-newline-style.c text eol=crlf
+Frontend/system-header-line-directive-ms-lineendings.c text eol=crlf
+Frontend/rewrite-includes-mixed-eol-crlf.* text eol=crlf
+clang/test/Frontend/rewrite-includes-mixed-eol-lf.h text eolf=lf

diff  --git a/llvm/docs/TestingGuide.rst b/llvm/docs/TestingGuide.rst
index 08617933519fdb..344a295226f6ae 100644
--- a/llvm/docs/TestingGuide.rst
+++ b/llvm/docs/TestingGuide.rst
@@ -360,6 +360,12 @@ Best practices for regression tests
 - Try to give values (including variables, blocks and functions) meaningful
   names, and avoid retaining complex names generated by the optimization
   pipeline (such as `

[clang] [clang][SYCL] Disable float128 device mode diagnostic (PR #128513)

2025-03-12 Thread Luke Drummond via cfe-commits

https://github.com/ldrumm closed 
https://github.com/llvm/llvm-project/pull/128513
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits