[PATCH] D140727: [XRay] Add initial support for loongarch64

2023-07-07 Thread Lu Weining via Phabricator via cfe-commits
SixWeining added a comment.

Since `R_LARCH_64_PCREL` has been supported, we can use version 2 xray and the 
patch summary should be modified accordingly.




Comment at: llvm/lib/Target/LoongArch/LoongArchAsmPrinter.cpp:187
+  OutStreamer->emitLabel(EndOfSled);
+  recordSled(BeginOfSled, MI, Kind); // FIXME: use version 2
 }

should use version 2:

```
recordSled(BeginOfSled, MI, Kind, 2);
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140727

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


[PATCH] D154635: [7/8][RISCV] Add rounding mode control variant for conversion intrinsics between floating-point and integer

2023-07-07 Thread Yueh-Ting (eop) Chen via Phabricator via cfe-commits
eopXD updated this revision to Diff 538012.
eopXD marked 3 inline comments as done.
eopXD added a comment.

Remove rounding mode variant of vfwcvt.f.f


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154635

Files:
  clang/include/clang/Basic/riscv_vector.td
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vfcvt.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vfncvt.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vfwcvt.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vfcvt.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vfncvt.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vfwcvt.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/non-overloaded/vfcvt.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/non-overloaded/vfncvt.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/non-overloaded/vfwcvt.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/overloaded/vfcvt.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/overloaded/vfncvt.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/overloaded/vfwcvt.c
  llvm/include/llvm/IR/IntrinsicsRISCV.td
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp
  llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
  llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td
  llvm/lib/Target/RISCV/RISCVInstrInfoVVLPatterns.td
  llvm/test/CodeGen/RISCV/rvv/ceil-vp.ll
  llvm/test/CodeGen/RISCV/rvv/double-round-conv.ll
  llvm/test/CodeGen/RISCV/rvv/fceil-constrained-sdnode.ll
  llvm/test/CodeGen/RISCV/rvv/fceil-sdnode.ll
  llvm/test/CodeGen/RISCV/rvv/ffloor-constrained-sdnode.ll
  llvm/test/CodeGen/RISCV/rvv/ffloor-sdnode.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-ceil-vp.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fceil-constrained-sdnode.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-ffloor-constrained-sdnode.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-floor-vp.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fround-costrained-sdnode.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fround.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-froundeven-constrained-sdnode.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-froundeven.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-round-vp.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-roundeven-vp.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-roundtozero-vp.ll
  llvm/test/CodeGen/RISCV/rvv/float-round-conv.ll
  llvm/test/CodeGen/RISCV/rvv/floor-vp.ll
  llvm/test/CodeGen/RISCV/rvv/fround-costrained-sdnode.ll
  llvm/test/CodeGen/RISCV/rvv/fround-sdnode.ll
  llvm/test/CodeGen/RISCV/rvv/froundeven-constrained-sdnode.ll
  llvm/test/CodeGen/RISCV/rvv/froundeven-sdnode.ll
  llvm/test/CodeGen/RISCV/rvv/half-round-conv.ll
  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/round-vp.ll
  llvm/test/CodeGen/RISCV/rvv/roundeven-vp.ll
  llvm/test/CodeGen/RISCV/rvv/roundtozero-vp.ll
  llvm/test/CodeGen/RISCV/rvv/unmasked-tu.ll
  llvm/test/CodeGen/RISCV/rvv/vfcvt-f-x.ll
  llvm/test/CodeGen/RISCV/rvv/vfcvt-f-xu.ll
  llvm/test/CodeGen/RISCV/rvv/vfcvt-x-f.ll
  llvm/test/CodeGen/RISCV/rvv/vfcvt-xu-f.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-f-f.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-f-x.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-f-xu.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-x-f.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-xu-f.ll
  llvm/test/CodeGen/RISCV/rvv/vfwcvt-f-f.ll
  llvm/test/CodeGen/RISCV/rvv/vfwcvt-f-x.ll
  llvm/test/CodeGen/RISCV/rvv/vfwcvt-f-xu.ll
  llvm/test/CodeGen/RISCV/rvv/vfwcvt-x-f.ll
  llvm/test/CodeGen/RISCV/rvv/vfwcvt-xu-f.ll

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


[PATCH] D154635: [7/8][RISCV] Add rounding mode control variant for conversion intrinsics between floating-point and integer

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

Remove rounding mode variant of vfwcvt.f.x, vfwcvt.f.xu
Add out-of-range semantic check and its corresponding test cases for the 
intrinsics added.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154635

Files:
  clang/include/clang/Basic/riscv_vector.td
  clang/lib/Sema/SemaChecking.cpp
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vfcvt.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vfncvt.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vfwcvt.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vfcvt.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vfncvt.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vfwcvt.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/non-overloaded/vfcvt.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/non-overloaded/vfncvt.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/non-overloaded/vfwcvt.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/overloaded/vfcvt.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/overloaded/vfncvt.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/overloaded/vfwcvt.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-handcrafted/vfcvt-out-of-range.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-handcrafted/vfncvt-out-of-range.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-handcrafted/vfwcvt-out-of-range.c
  llvm/include/llvm/IR/IntrinsicsRISCV.td
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp
  llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
  llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td
  llvm/lib/Target/RISCV/RISCVInstrInfoVVLPatterns.td
  llvm/test/CodeGen/RISCV/rvv/ceil-vp.ll
  llvm/test/CodeGen/RISCV/rvv/double-round-conv.ll
  llvm/test/CodeGen/RISCV/rvv/fceil-constrained-sdnode.ll
  llvm/test/CodeGen/RISCV/rvv/fceil-sdnode.ll
  llvm/test/CodeGen/RISCV/rvv/ffloor-constrained-sdnode.ll
  llvm/test/CodeGen/RISCV/rvv/ffloor-sdnode.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-ceil-vp.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fceil-constrained-sdnode.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-ffloor-constrained-sdnode.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-floor-vp.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fround-costrained-sdnode.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fround.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-froundeven-constrained-sdnode.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-froundeven.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-round-vp.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-roundeven-vp.ll
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-roundtozero-vp.ll
  llvm/test/CodeGen/RISCV/rvv/float-round-conv.ll
  llvm/test/CodeGen/RISCV/rvv/floor-vp.ll
  llvm/test/CodeGen/RISCV/rvv/fround-costrained-sdnode.ll
  llvm/test/CodeGen/RISCV/rvv/fround-sdnode.ll
  llvm/test/CodeGen/RISCV/rvv/froundeven-constrained-sdnode.ll
  llvm/test/CodeGen/RISCV/rvv/froundeven-sdnode.ll
  llvm/test/CodeGen/RISCV/rvv/half-round-conv.ll
  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/round-vp.ll
  llvm/test/CodeGen/RISCV/rvv/roundeven-vp.ll
  llvm/test/CodeGen/RISCV/rvv/roundtozero-vp.ll
  llvm/test/CodeGen/RISCV/rvv/unmasked-tu.ll
  llvm/test/CodeGen/RISCV/rvv/vfcvt-f-x.ll
  llvm/test/CodeGen/RISCV/rvv/vfcvt-f-xu.ll
  llvm/test/CodeGen/RISCV/rvv/vfcvt-x-f.ll
  llvm/test/CodeGen/RISCV/rvv/vfcvt-xu-f.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-f-f.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-f-x.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-f-xu.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-x-f.ll
  llvm/test/CodeGen/RISCV/rvv/vfncvt-xu-f.ll
  llvm/test/CodeGen/RISCV/rvv/vfwcvt-f-f.ll
  llvm/test/CodeGen/RISCV/rvv/vfwcvt-f-x.ll
  llvm/test/CodeGen/RISCV/rvv/vfwcvt-f-xu.ll
  llvm/test/CodeGen/RISCV/rvv/vfwcvt-x-f.ll
  llvm/test/CodeGen/RISCV/rvv/vfwcvt-xu-f.ll

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


[PATCH] D154636: [8/8][RISCV] Add rounding mode control variant for vfredosum, vfredusum, vfwredosum, vfwredusum

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

Add sema checking and corresponding test case for added intrinsics.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154636

Files:
  clang/include/clang/Basic/riscv_vector.td
  clang/lib/Sema/SemaChecking.cpp
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vfredosum.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vfredusum.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vfwredosum.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/non-overloaded/vfwredusum.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vfredosum.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vfredusum.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vfwredosum.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/non-policy/overloaded/vfwredusum.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/non-overloaded/vfredosum.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/non-overloaded/vfredusum.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/non-overloaded/vfwredosum.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/non-overloaded/vfwredusum.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/overloaded/vfredosum.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/overloaded/vfredusum.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/overloaded/vfwredosum.c
  
clang/test/CodeGen/RISCV/rvv-intrinsics-autogenerated/policy/overloaded/vfwredusum.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-handcrafted/vfredosum-out-of-range.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-handcrafted/vfredusum-out-of-range.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-handcrafted/vfwredosum-out-of-range.c
  clang/test/CodeGen/RISCV/rvv-intrinsics-handcrafted/vfwredusum-out-of-range.c
  llvm/include/llvm/IR/IntrinsicsRISCV.td
  llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
  llvm/lib/Target/RISCV/RISCVInstrInfoVVLPatterns.td
  llvm/test/CodeGen/RISCV/rvv/unmasked-ta.ll
  llvm/test/CodeGen/RISCV/rvv/vfredosum.ll
  llvm/test/CodeGen/RISCV/rvv/vfredusum.ll
  llvm/test/CodeGen/RISCV/rvv/vfwredosum.ll
  llvm/test/CodeGen/RISCV/rvv/vfwredusum.ll

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


[PATCH] D145265: [Pipeline] Remove GlobalCleanupPM

2023-07-07 Thread Nikita Popov via Phabricator via cfe-commits
nikic added a comment.

In D145265#4478621 , @aeubanks wrote:

> @nikic could you try running this over the rust tests again?

Ignoring some unrelated powerpc data layout failures, these codegen tests fail:

  [codegen] tests/codegen/issues/issue-45222.rs
  [codegen] tests/codegen/issues/issue-45466.rs
  [codegen] tests/codegen/issues/issue-69101-bounds-check.rs
  [codegen] tests/codegen/iter-repeat-n-trivial-drop.rs
  [codegen] tests/codegen/slice-as_chunks.rs

The `iter-repeat-n-trivial-drop.rs` and `slice-as_chunks.rs` failures are 
cosmetic.

`issues-45222.rs` is the same as last time (loop not folded to constant).

`issue-45466.rs` fails to convert a loop into a memset 0 (this looks like the 
simplest test case, because it has essentially just one function in initial IR).

`issue-69101-bounds-check.rs` leaves behind panic_bounds_checks in 
already_sliced_no_bounds_check.

I've put the input IR for these three failure up at 
https://gist.github.com/nikic/9ec0bc02d451e7abd0f8d78800c2206c.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145265

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


[PATCH] D154688: [clang] Show verify prefix in error messages

2023-07-07 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder created this revision.
tbaeder added a reviewer: clang.
Herald added a project: All.
tbaeder 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/D154688

Files:
  clang/lib/Frontend/VerifyDiagnosticConsumer.cpp


Index: clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
===
--- clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
+++ clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
@@ -876,8 +876,11 @@
 OS << ": " << I->second;
   }
 
+  std::string Prefix = *Diags.getDiagnosticOptions().VerifyPrefixes.begin();
+  std::string KindStr = Prefix + "-" + Kind;
+
   Diags.Report(diag::err_verify_inconsistent_diags).setForceEmit()
-<< Kind << /*Unexpected=*/true << OS.str();
+  << KindStr << /*Unexpected=*/true << OS.str();
   return std::distance(diag_begin, diag_end);
 }
 
@@ -907,8 +910,11 @@
 OS << ": " << D->Text;
   }
 
+  std::string Prefix = *Diags.getDiagnosticOptions().VerifyPrefixes.begin();
+  std::string KindStr = Prefix + "-" + Kind;
+
   Diags.Report(diag::err_verify_inconsistent_diags).setForceEmit()
-<< Kind << /*Unexpected=*/false << OS.str();
+  << KindStr << /*Unexpected=*/false << OS.str();
   return DL.size();
 }
 


Index: clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
===
--- clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
+++ clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
@@ -876,8 +876,11 @@
 OS << ": " << I->second;
   }
 
+  std::string Prefix = *Diags.getDiagnosticOptions().VerifyPrefixes.begin();
+  std::string KindStr = Prefix + "-" + Kind;
+
   Diags.Report(diag::err_verify_inconsistent_diags).setForceEmit()
-<< Kind << /*Unexpected=*/true << OS.str();
+  << KindStr << /*Unexpected=*/true << OS.str();
   return std::distance(diag_begin, diag_end);
 }
 
@@ -907,8 +910,11 @@
 OS << ": " << D->Text;
   }
 
+  std::string Prefix = *Diags.getDiagnosticOptions().VerifyPrefixes.begin();
+  std::string KindStr = Prefix + "-" + Kind;
+
   Diags.Report(diag::err_verify_inconsistent_diags).setForceEmit()
-<< Kind << /*Unexpected=*/false << OS.str();
+  << KindStr << /*Unexpected=*/false << OS.str();
   return DL.size();
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D140727: [XRay] Add initial support for loongarch64

2023-07-07 Thread Limin Zhang via Phabricator via cfe-commits
Ami-zhang added inline comments.



Comment at: compiler-rt/lib/xray/xray_loongarch64.cpp:23
+enum PatchOpcodes : uint32_t {
+  PO_ADDID = 0x02c0,  // addi.d rd, rj, imm
+  PO_SD = 0x29c0, // st.d rd, base, offset

MaskRay wrote:
> I think the `PO_` style actually harms readability. Most instructions are 
> used just once. It's more readable just using the magic number when it is 
> needed paired with an inline comment
> 
> `Address[10] = insn2RI12(0x02c0, RegNum::RN_S, ...) // addi.d ...`
Ok, updated it. Thanks for your suggestion.



Comment at: compiler-rt/lib/xray/xray_loongarch64.cpp:153
+   const XRaySledEntry &Sled) XRAY_NEVER_INSTRUMENT {
+  // FIXME: In the future we'd need to distinguish between non-tail exits and
+  // tail exits for better information preservation.

MaskRay wrote:
> I know you copy the pattern from other patterns, but we should use TODO here. 
> An unimplemented minor feature is not FIXME.
Done.



Comment at: compiler-rt/lib/xray/xray_trampoline_loongarch64.S:27
+  .cfi_offset 1, -8
+  st.d$a7, $sp, 120
+  st.d$a6, $sp, 112

MaskRay wrote:
> You can use `.irpc` to simplify this a bit. See 
> libunwind/src/UnwindRegistersSave.S
Done. 



Comment at: compiler-rt/test/xray/TestCases/Posix/arg1-arg0-logging.cpp:9
 // TODO: Support these in ARM and PPC
-// XFAIL: target={{(arm|aarch64|mips).*}}
+// XFAIL: target={{(arm|aarch64|loongarch64|mips).*}}
 // UNSUPPORTED: target=powerpc64le{{.*}}

MaskRay wrote:
> I added aarch64 support. You may rebase and add loongarch64 on the 
> `REQUIRES:` line.
Rebased.



Comment at: compiler-rt/test/xray/TestCases/Posix/basic-filtering.cpp:26
 //
-// REQUIRES: x86_64-target-arch
+// REQUIRES: x86_64-target-arch || loongarch64-target-arch
 // REQUIRES: built-in-llvm-tree

MaskRay wrote:
> Most `REQUIRES: x86_64-target-arch` are unnecessarily constrained. I just 
> removed them. You may rebase and avoid changes to these test files.
Rebased.



Comment at: llvm/lib/Target/LoongArch/LoongArchAsmPrinter.cpp:187
+  OutStreamer->emitLabel(EndOfSled);
+  recordSled(BeginOfSled, MI, Kind); // FIXME: use version 2
 }

SixWeining wrote:
> should use version 2:
> 
> ```
> recordSled(BeginOfSled, MI, Kind, 2);
> ```
Yes, updated it.



Comment at: llvm/test/CodeGen/LoongArch/xray-attribute-instrumentation.ll:11
+; CHECK-NEXT:  b .Lxray_sled_end0
+; CHECK-NEXT:  nop
+; CHECK-NEXT:  nop

SixWeining wrote:
> CHECK-COUNT-11
Done.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140727

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


[PATCH] D154603: [analyzer][clangsa] Add new option to alpha.security.cert.InvalidPtrChecker

2023-07-07 Thread Donát Nagy via Phabricator via cfe-commits
donat.nagy added a comment.

The commit looks good in general, I have a few minor suggestions and a serious 
question about the state transition bureaucracy.




Comment at: clang/lib/StaticAnalyzer/Checkers/cert/InvalidPtrChecker.cpp:65-66
+  // If set to true, consider getenv calls as invalidating operations on the
+  // environment variable buffer. This is implied in the standard, but can lead
+  // to practical false positives.
+  bool InvalidatingGetEnv = false;

Nitpick: "practical false positives" sounds strange for me, consider writing
[...but] "in practice does not cause problems (in the commonly used 
environments)"
or something similar.



Comment at: clang/lib/StaticAnalyzer/Checkers/cert/InvalidPtrChecker.cpp:125
 
-  const NoteTag *Note =
-  C.getNoteTag([SymbolicEnvPtrRegion, FunctionName](
-   PathSensitiveBugReport &BR, llvm::raw_ostream &Out) {
-if (!BR.isInteresting(SymbolicEnvPtrRegion))
-  return;
-Out << '\'' << FunctionName
-<< "' call may invalidate the environment parameter of 'main'";
-  });
+  ExplodedNode *CurrentChainEnd = nullptr;
+

Perhaps add a comment that clarifies that passing a `nullptr` as the 
ExplodedNode to `addTransition` is equivalent to specifying the current node. I 
remember this because I was studying its implementation recently, but I 
would've been surprised and suspicious otherwise.



Comment at: clang/lib/StaticAnalyzer/Checkers/cert/InvalidPtrChecker.cpp:218
+State->add(Call.getReturnValue().getAsRegion());
+   C.addTransition(State);
+  }

I fear that this state transition will go "sideways" and the later state 
transitions (which add the note tags) will branch off instead of building onto 
this. IIUC calling `CheckerContext::addTransition` registers the transition 
without updating the "current ExplodedNode" field of `CheckerContext`, so you 
need to explicitly store and pass around the ExplodedNode returned by it if you 
want to build on it.

This is an ugly and counter-intuitive API, and I also ran into a very similar 
issue a few weeks ago (@Szelethus helped me).



Comment at: clang/test/Analysis/cert/env34-c.c:6
+//
+// TODO: write test cases that follow the pattern:
+//   "getenv -> store pointer -> setenv -> use stored pointer"

gamesh411 wrote:
> This test file is incomplete.
> I would welcome suggestions here as to how to test this.
> Should a new file be created for the config option with different test cases, 
> or is this file to be extended?
Personally I'd prefer putting those cases into a separate files, because this 
test file is already 340 lines long and it'd be difficult to understand if it 
was filled with conditional checks. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154603

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


[PATCH] D140727: [XRay] Add initial support for loongarch64

2023-07-07 Thread Limin Zhang via Phabricator via cfe-commits
Ami-zhang updated this revision to Diff 538022.
Ami-zhang added a comment.

Rebase and make some improvements.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140727

Files:
  clang/lib/Driver/XRayArgs.cpp
  compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake
  compiler-rt/lib/xray/CMakeLists.txt
  compiler-rt/lib/xray/xray_interface.cpp
  compiler-rt/lib/xray/xray_loongarch64.cpp
  compiler-rt/lib/xray/xray_trampoline_loongarch64.S
  compiler-rt/lib/xray/xray_tsc.h
  compiler-rt/test/xray/TestCases/Posix/c-test.cpp
  compiler-rt/test/xray/TestCases/Posix/fdr-thread-order.cpp
  llvm/lib/CodeGen/XRayInstrumentation.cpp
  llvm/lib/Target/LoongArch/LoongArchAsmPrinter.cpp
  llvm/lib/Target/LoongArch/LoongArchAsmPrinter.h
  llvm/lib/Target/LoongArch/LoongArchSubtarget.h
  llvm/lib/XRay/InstrumentationMap.cpp
  llvm/test/CodeGen/LoongArch/xray-attribute-instrumentation.ll

Index: llvm/test/CodeGen/LoongArch/xray-attribute-instrumentation.ll
===
--- /dev/null
+++ llvm/test/CodeGen/LoongArch/xray-attribute-instrumentation.ll
@@ -0,0 +1,56 @@
+; RUN: llc --mtriple=loongarch64 %s -o - | FileCheck %s
+; RUN: llc --mtriple=loongarch64 -filetype=obj %s -o %t
+; RUN: llvm-readobj -r %t | FileCheck %s --check-prefix=RELOC
+
+define i32 @foo() nounwind noinline uwtable "function-instrument"="xray-always" {
+; CHECK-LABEL: foo:
+; CHECK-LABEL: .Lfunc_begin0:
+; CHECK:   .p2align 2
+; CHECK-LABEL: .Lxray_sled_begin0:
+; CHECK-NEXT:  b .Lxray_sled_end0
+; CHECK-COUNT-11:  nop
+; CHECK-LABEL: .Lxray_sled_end0:
+  ret i32 0
+; CHECK-LABEL: .Lxray_sled_begin1:
+; CHECK-NEXT:  b .Lxray_sled_end1
+; CHECK-COUNT-11:  nop
+; CHECK-NEXT: .Lxray_sled_end1:
+; CHECK-NEXT:  ret
+; CHECK-NEXT: .Lfunc_end0:
+}
+
+; CHECK-LABEL: .section xray_instr_map
+; CHECK-NEXT: .Lxray_sleds_start0:
+; CHECK-NEXT: .Ltmp0:
+; CHECK-NEXT: .dword .Lxray_sled_begin0-.Ltmp0
+; CHECK-NEXT: .dword .Lfunc_begin0-(.Ltmp0+8)
+; CHECK-NEXT: .byte 0x00
+; CHECK-NEXT: .byte 0x01
+; CHECK-NEXT: .byte 0x02
+; CHECK-NEXT: .space 13
+; CHECK-NEXT: .Ltmp1:
+; CHECK-NEXT: .dword .Lxray_sled_begin1-.Ltmp1
+; CHECK-NEXT: .dword .Lfunc_begin0-(.Ltmp1+8)
+; CHECK-NEXT: .byte 0x01
+; CHECK-NEXT: .byte 0x01
+; CHECK-NEXT: .byte 0x02
+; CHECK-NEXT: .space 13
+; CHECK-NEXT: .Lxray_sleds_end0:
+
+; CHECK-LABEL:  .section xray_fn_idx
+; CHECK-LABEL:  .Lxray_fn_idx0:
+; CHECK:  .dword .Lxray_sleds_start0-.Lxray_fn_idx0
+; CHECK-NEXT: .dword 2
+
+; RELOC:  Section ([[#]]) .relaxray_instr_map {
+; RELOC-NEXT:   0x0 R_LARCH_64_PCREL .text 0x0
+; RELOC-NEXT:   0x8 R_LARCH_64_PCREL .text 0x0
+; RELOC-NEXT:   0x20 R_LARCH_64_PCREL .text 0x34
+; RELOC-NEXT:   0x28 R_LARCH_64_PCREL .text 0x0
+; RELOC-NEXT: }
+; RELOC-NEXT: Section ([[#]]) .relaxray_fn_idx {
+; RELOC-NEXT:   0x0 R_LARCH_64_PCREL xray_instr_map 0x0
+; RELOC-NEXT: }
+; RELOC-NEXT: Section ([[#]]) .rela.eh_frame {
+; RELOC-NEXT:   0x1C R_LARCH_32_PCREL .text 0x0
+; RELOC-NEXT: }
Index: llvm/lib/XRay/InstrumentationMap.cpp
===
--- llvm/lib/XRay/InstrumentationMap.cpp
+++ llvm/lib/XRay/InstrumentationMap.cpp
@@ -60,6 +60,7 @@
   // Find the section named "xray_instr_map".
   if ((!ObjFile.getBinary()->isELF() && !ObjFile.getBinary()->isMachO()) ||
   !(ObjFile.getBinary()->getArch() == Triple::x86_64 ||
+ObjFile.getBinary()->getArch() == Triple::loongarch64 ||
 ObjFile.getBinary()->getArch() == Triple::ppc64le ||
 ObjFile.getBinary()->getArch() == Triple::arm ||
 ObjFile.getBinary()->getArch() == Triple::aarch64))
Index: llvm/lib/Target/LoongArch/LoongArchSubtarget.h
===
--- llvm/lib/Target/LoongArch/LoongArchSubtarget.h
+++ llvm/lib/Target/LoongArch/LoongArchSubtarget.h
@@ -96,6 +96,7 @@
   MVT getGRLenVT() const { return GRLenVT; }
   unsigned getGRLen() const { return GRLen; }
   LoongArchABI::ABI getTargetABI() const { return TargetABI; }
+  bool isXRaySupported() const override { return is64Bit(); }
 };
 } // end namespace llvm
 
Index: llvm/lib/Target/LoongArch/LoongArchAsmPrinter.h
===
--- llvm/lib/Target/LoongArch/LoongArchAsmPrinter.h
+++ llvm/lib/Target/LoongArch/LoongArchAsmPrinter.h
@@ -42,6 +42,9 @@
  const char *ExtraCode, raw_ostream &OS) override;
 
   void LowerPATCHABLE_FUNCTION_ENTER(const MachineInstr &MI);
+  void LowerPATCHABLE_FUNCTION_EXIT(const MachineInstr &MI);
+  void LowerPATCHABLE_TAIL_CALL(const MachineInstr &MI);
+  void emitSled(const MachineInstr &MI, SledKind Kind);
 
   // tblgen'erated function.
   bool emitPseudoExpansionLowering(MCStreamer &OutStreamer,
Index: llvm/lib/Target/LoongArch/LoongArchAsmPrinter.cpp
===

[clang] 7916573 - [ARM][Driver] Change float-abi warning

2023-07-07 Thread Michael Platings via cfe-commits

Author: Michael Platings
Date: 2023-07-07T09:41:18+01:00
New Revision: 79165735e11e40e1fbbb91ccbdd4df24d6349837

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

LOG: [ARM][Driver] Change float-abi warning

Previously the warning stated "flag ignored" which is only partially
true - the invalid flag would prevent -feature +soft-float-abi from
being emitted which resulted in user-visible behaviour like
__ARM_PCS_VFP being defined.

Rather than attempt to coerce invalid flags into valid behaviour, don't
describe the expected behaviour.

Ideally the warning would be an error, as it is in GCC. However there
are tests in llvm-project that trigger the warning. Therefore one has to
assume that making the warning an error would break other code that
already exists in the wild.

Also apply test improvements suggested by @MaskRay on D150902.

Reviewed By: simon_tatham

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

Added: 


Modified: 
clang/include/clang/Basic/DiagnosticDriverKinds.td
clang/include/clang/Basic/DiagnosticGroups.td
clang/test/Driver/arm-no-float-regs.c

Removed: 




diff  --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td 
b/clang/include/clang/Basic/DiagnosticDriverKinds.td
index d8112641eaf58f..095fbfe8ba2b1d 100644
--- a/clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -416,10 +416,10 @@ def warn_drv_assuming_mfloat_abi_is : Warning<
   "unknown platform, assuming -mfloat-abi=%0">;
 def warn_drv_unsupported_float_abi_by_lib : Warning<
   "float ABI '%0' is not supported by current library">,
-  InGroup>;
+  InGroup;
 def warn_drv_no_floating_point_registers: Warning<
-  "'%0': selected processor lacks floating point registers; flag ignored">,
-  InGroup;
+  "'%0': selected processor lacks floating point registers">,
+  InGroup;
 def warn_ignoring_ftabstop_value : Warning<
   "ignoring invalid -ftabstop value '%0', using default value %1">;
 def warn_drv_overriding_flag_option : Warning<

diff  --git a/clang/include/clang/Basic/DiagnosticGroups.td 
b/clang/include/clang/Basic/DiagnosticGroups.td
index 7f5fb2c1b1495d..8b15337fda8829 100644
--- a/clang/include/clang/Basic/DiagnosticGroups.td
+++ b/clang/include/clang/Basic/DiagnosticGroups.td
@@ -1349,6 +1349,8 @@ def OptionIgnored : DiagGroup<"option-ignored">;
 
 def UnknownArgument : DiagGroup<"unknown-argument">;
 
+def UnsupportedABI : DiagGroup<"unsupported-abi">;
+
 // A warning group for warnings about code that clang accepts when
 // compiling OpenCL C/C++ but which is not compatible with the SPIR(-V) spec.
 def SpirCompat : DiagGroup<"spir-compat">;

diff  --git a/clang/test/Driver/arm-no-float-regs.c 
b/clang/test/Driver/arm-no-float-regs.c
index b542f7d2805fe0..b46d8fc292c916 100644
--- a/clang/test/Driver/arm-no-float-regs.c
+++ b/clang/test/Driver/arm-no-float-regs.c
@@ -1,7 +1,6 @@
-// REQUIRES: arm-registered-target
-
 // Check that -mfloat-abi=hard gives a warning if FP registers aren't 
available.
-// RUN: %clang --target=arm-none-eabi -mcpu=cortex-m0 -mfloat-abi=hard -### -c 
%s 2>&1
+// RUN: %clang --target=arm-none-eabi -mcpu=cortex-m0 -mfloat-abi=hard -### -c 
%s 2>&1 \
+// RUN:   | FileCheck %s
 
 // RUN: %clang --target=arm-none-eabi -mcpu=cortex-m0 -mhard-float -### -c %s 
2>&1 \
 // RUN:   | FileCheck -check-prefix=HARDFLOAT %s
@@ -20,4 +19,4 @@
 
 // CHECK: warning: '-mfloat-abi=hard': selected processor lacks floating point 
registers
 // HARDFLOAT: warning: '-mhard-float': selected processor lacks floating point 
registers
-// NOWARN-NOT: selected processor lacks floating point registers
+// NOWARN-NOT: warning:



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


[PATCH] D154578: [ARM][Driver] Change float-abi warning

2023-07-07 Thread Michael Platings 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 rG79165735e11e: [ARM][Driver] Change float-abi warning 
(authored by michaelplatings).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154578

Files:
  clang/include/clang/Basic/DiagnosticDriverKinds.td
  clang/include/clang/Basic/DiagnosticGroups.td
  clang/test/Driver/arm-no-float-regs.c


Index: clang/test/Driver/arm-no-float-regs.c
===
--- clang/test/Driver/arm-no-float-regs.c
+++ clang/test/Driver/arm-no-float-regs.c
@@ -1,7 +1,6 @@
-// REQUIRES: arm-registered-target
-
 // Check that -mfloat-abi=hard gives a warning if FP registers aren't 
available.
-// RUN: %clang --target=arm-none-eabi -mcpu=cortex-m0 -mfloat-abi=hard -### -c 
%s 2>&1
+// RUN: %clang --target=arm-none-eabi -mcpu=cortex-m0 -mfloat-abi=hard -### -c 
%s 2>&1 \
+// RUN:   | FileCheck %s
 
 // RUN: %clang --target=arm-none-eabi -mcpu=cortex-m0 -mhard-float -### -c %s 
2>&1 \
 // RUN:   | FileCheck -check-prefix=HARDFLOAT %s
@@ -20,4 +19,4 @@
 
 // CHECK: warning: '-mfloat-abi=hard': selected processor lacks floating point 
registers
 // HARDFLOAT: warning: '-mhard-float': selected processor lacks floating point 
registers
-// NOWARN-NOT: selected processor lacks floating point registers
+// NOWARN-NOT: warning:
Index: clang/include/clang/Basic/DiagnosticGroups.td
===
--- clang/include/clang/Basic/DiagnosticGroups.td
+++ clang/include/clang/Basic/DiagnosticGroups.td
@@ -1349,6 +1349,8 @@
 
 def UnknownArgument : DiagGroup<"unknown-argument">;
 
+def UnsupportedABI : DiagGroup<"unsupported-abi">;
+
 // A warning group for warnings about code that clang accepts when
 // compiling OpenCL C/C++ but which is not compatible with the SPIR(-V) spec.
 def SpirCompat : DiagGroup<"spir-compat">;
Index: clang/include/clang/Basic/DiagnosticDriverKinds.td
===
--- clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -416,10 +416,10 @@
   "unknown platform, assuming -mfloat-abi=%0">;
 def warn_drv_unsupported_float_abi_by_lib : Warning<
   "float ABI '%0' is not supported by current library">,
-  InGroup>;
+  InGroup;
 def warn_drv_no_floating_point_registers: Warning<
-  "'%0': selected processor lacks floating point registers; flag ignored">,
-  InGroup;
+  "'%0': selected processor lacks floating point registers">,
+  InGroup;
 def warn_ignoring_ftabstop_value : Warning<
   "ignoring invalid -ftabstop value '%0', using default value %1">;
 def warn_drv_overriding_flag_option : Warning<


Index: clang/test/Driver/arm-no-float-regs.c
===
--- clang/test/Driver/arm-no-float-regs.c
+++ clang/test/Driver/arm-no-float-regs.c
@@ -1,7 +1,6 @@
-// REQUIRES: arm-registered-target
-
 // Check that -mfloat-abi=hard gives a warning if FP registers aren't available.
-// RUN: %clang --target=arm-none-eabi -mcpu=cortex-m0 -mfloat-abi=hard -### -c %s 2>&1
+// RUN: %clang --target=arm-none-eabi -mcpu=cortex-m0 -mfloat-abi=hard -### -c %s 2>&1 \
+// RUN:   | FileCheck %s
 
 // RUN: %clang --target=arm-none-eabi -mcpu=cortex-m0 -mhard-float -### -c %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=HARDFLOAT %s
@@ -20,4 +19,4 @@
 
 // CHECK: warning: '-mfloat-abi=hard': selected processor lacks floating point registers
 // HARDFLOAT: warning: '-mhard-float': selected processor lacks floating point registers
-// NOWARN-NOT: selected processor lacks floating point registers
+// NOWARN-NOT: warning:
Index: clang/include/clang/Basic/DiagnosticGroups.td
===
--- clang/include/clang/Basic/DiagnosticGroups.td
+++ clang/include/clang/Basic/DiagnosticGroups.td
@@ -1349,6 +1349,8 @@
 
 def UnknownArgument : DiagGroup<"unknown-argument">;
 
+def UnsupportedABI : DiagGroup<"unsupported-abi">;
+
 // A warning group for warnings about code that clang accepts when
 // compiling OpenCL C/C++ but which is not compatible with the SPIR(-V) spec.
 def SpirCompat : DiagGroup<"spir-compat">;
Index: clang/include/clang/Basic/DiagnosticDriverKinds.td
===
--- clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -416,10 +416,10 @@
   "unknown platform, assuming -mfloat-abi=%0">;
 def warn_drv_unsupported_float_abi_by_lib : Warning<
   "float ABI '%0' is not supported by current library">,
-  InGroup>;
+  InGroup;
 def warn_drv_no_floating_point_registers: Warning<
-  "'%0': selected processor lacks floating point registers; flag ignored">,
-  InGroup;
+  "'%0': selected processor lacks 

[PATCH] D154689: [clang] Correct calculation of MemberExpr's dependence

2023-07-07 Thread Mariya Podchishchaeva via Phabricator via cfe-commits
Fznamznon created this revision.
Herald added a project: All.
Fznamznon requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Due to incorrect calculation false positive diagnostics were emitted.

Fixes https://github.com/llvm/llvm-project/issues/48731


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D154689

Files:
  clang/docs/ReleaseNotes.rst
  clang/lib/AST/ComputeDependence.cpp
  clang/lib/AST/Expr.cpp
  clang/test/SemaTemplate/temp_arg_nontype_cxx20.cpp

Index: clang/test/SemaTemplate/temp_arg_nontype_cxx20.cpp
===
--- clang/test/SemaTemplate/temp_arg_nontype_cxx20.cpp
+++ clang/test/SemaTemplate/temp_arg_nontype_cxx20.cpp
@@ -306,3 +306,10 @@
 f(A()); // OK
   }
 }
+
+namespace GH48731 {
+template  using N = int;
+struct X { template void f(); };
+template decltype((X().f>(), ...)) x;
+template decltype(((new X())->f>(), ...)) y;
+}
Index: clang/lib/AST/Expr.cpp
===
--- clang/lib/AST/Expr.cpp
+++ clang/lib/AST/Expr.cpp
@@ -1745,16 +1745,7 @@
   MemberExpr *E = new (Mem) MemberExpr(Base, IsArrow, OperatorLoc, MemberDecl,
NameInfo, T, VK, OK, NOUR);
 
-  // FIXME: remove remaining dependence computation to computeDependence().
-  auto Deps = E->getDependence();
   if (HasQualOrFound) {
-// FIXME: Wrong. We should be looking at the member declaration we found.
-if (QualifierLoc && QualifierLoc.getNestedNameSpecifier()->isDependent())
-  Deps |= ExprDependence::TypeValueInstantiation;
-else if (QualifierLoc &&
- QualifierLoc.getNestedNameSpecifier()->isInstantiationDependent())
-  Deps |= ExprDependence::Instantiation;
-
 E->MemberExprBits.HasQualifierOrFoundDecl = true;
 
 MemberExprNameQualifier *NQ =
@@ -1766,13 +1757,16 @@
   E->MemberExprBits.HasTemplateKWAndArgsInfo =
   TemplateArgs || TemplateKWLoc.isValid();
 
+  // FIXME: remove remaining dependence computation to computeDependence().
+  auto Deps = E->getDependence();
   if (TemplateArgs) {
 auto TemplateArgDeps = TemplateArgumentDependence::None;
 E->getTrailingObjects()->initializeFrom(
 TemplateKWLoc, *TemplateArgs,
 E->getTrailingObjects(), TemplateArgDeps);
-if (TemplateArgDeps & TemplateArgumentDependence::Instantiation)
-  Deps |= ExprDependence::Instantiation;
+for (const TemplateArgumentLoc &ArgLoc : TemplateArgs->arguments()) {
+  Deps |= toExprDependence(ArgLoc.getArgument().getDependence());
+}
   } else if (TemplateKWLoc.isValid()) {
 E->getTrailingObjects()->initializeFrom(
 TemplateKWLoc);
Index: clang/lib/AST/ComputeDependence.cpp
===
--- clang/lib/AST/ComputeDependence.cpp
+++ clang/lib/AST/ComputeDependence.cpp
@@ -611,9 +611,24 @@
   return D;
 }
 
+static inline ExprDependence getDependenceInExpr(DeclarationNameInfo Name) {
+  auto D = ExprDependence::None;
+  if (Name.isInstantiationDependent())
+D |= ExprDependence::Instantiation;
+  if (Name.containsUnexpandedParameterPack())
+D |= ExprDependence::UnexpandedPack;
+  return D;
+}
+
 ExprDependence clang::computeDependence(MemberExpr *E) {
-  auto *MemberDecl = E->getMemberDecl();
   auto D = E->getBase()->getDependence();
+  D |= getDependenceInExpr(E->getMemberNameInfo());
+
+  if (auto *NNS = E->getQualifier())
+D |= toExprDependence(NNS->getDependence() &
+  ~NestedNameSpecifierDependence::Dependent);
+
+  auto *MemberDecl = E->getMemberDecl();
   if (FieldDecl *FD = dyn_cast(MemberDecl)) {
 DeclContext *DC = MemberDecl->getDeclContext();
 // dyn_cast_or_null is used to handle objC variables which do not
@@ -723,15 +738,6 @@
   return D;
 }
 
-static inline ExprDependence getDependenceInExpr(DeclarationNameInfo Name) {
-  auto D = ExprDependence::None;
-  if (Name.isInstantiationDependent())
-D |= ExprDependence::Instantiation;
-  if (Name.containsUnexpandedParameterPack())
-D |= ExprDependence::UnexpandedPack;
-  return D;
-}
-
 ExprDependence
 clang::computeDependence(OverloadExpr *E, bool KnownDependent,
  bool KnownInstantiationDependent,
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -568,6 +568,9 @@
 - Clang now correctly evaluates ``__has_extension (cxx_defaulted_functions)``
   and ``__has_extension (cxx_default_function_template_args)`` to 1.
   (`#61758 `_)
+- Fixed false positive error diagnostic when pack expansion appears in template
+  parameters of a member expression.
+  (`#48731 `_)
 
 Bug Fixes to Compiler Builtins
 ^^
__

[PATCH] D154689: [clang] Correct calculation of MemberExpr's dependence

2023-07-07 Thread Mariya Podchishchaeva via Phabricator via cfe-commits
Fznamznon added inline comments.



Comment at: clang/lib/AST/ComputeDependence.cpp:625
   auto D = E->getBase()->getDependence();
+  D |= getDependenceInExpr(E->getMemberNameInfo());
+

While implementing this patch I was following Richard's guide from 
https://github.com/llvm/llvm-project/issues/48731#issuecomment-1529150797 . The 
problem is, I didn't manage to write a test that would fail due to clang not 
taking into account `NameInfo` dependence. Turns out in most cases where it can 
be dependent either Base itself is dependent or 
CXXPseudoDestructorExpr/CXXDependentScopeMemberExpr is created inside the 
template function.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154689

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


[PATCH] D153914: [clang-cl] Enable concatenation of predefined identifiers

2023-07-07 Thread Richard Dzenis via Phabricator via cfe-commits
RIscRIpt updated this revision to Diff 538025.
RIscRIpt added a comment.

Rebased onto main


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153914

Files:
  clang/include/clang/Basic/DiagnosticGroups.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Basic/TokenKinds.h
  clang/include/clang/Parse/Parser.h
  clang/include/clang/Sema/Sema.h
  clang/lib/Parse/ParseExpr.cpp
  clang/lib/Sema/Sema.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/test/Sema/ms_predefined_expr.cpp

Index: clang/test/Sema/ms_predefined_expr.cpp
===
--- clang/test/Sema/ms_predefined_expr.cpp
+++ clang/test/Sema/ms_predefined_expr.cpp
@@ -6,4 +6,47 @@
  const char c[] = __FUNCSIG__; // expected-warning{{initializing an array from a '__FUNCSIG__' predefined identifier is a Microsoft extension}}
  const char d[] = __func__; // expected-warning{{initializing an array from a '__func__' predefined identifier is a Microsoft extension}}
  const char e[] = __PRETTY_FUNCTION__; // expected-warning{{initializing an array from a '__PRETTY_FUNCTION__' predefined identifier is a Microsoft extension}}
+ const wchar_t f[] = L__FUNCTION__; // expected-warning{{initializing an array from a 'L__FUNCTION__' predefined identifier is a Microsoft extension}}
+ const wchar_t g[] = L__FUNCSIG__; // expected-warning{{initializing an array from a 'L__FUNCSIG__' predefined identifier is a Microsoft extension}}
+}
+
+// Test concatenation
+
+void eat_const_char_p(const char*);
+void eat_const_wchar_p(const wchar_t*);
+
+void test_concat() {
+  eat_const_char_p("s" __FUNCTION__); // expected-warning{{concatenation of predefined identifier '__FUNCTION__' is a Microsoft extension}}
+  eat_const_char_p("s" __FUNCDNAME__); // expected-warning{{concatenation of predefined identifier '__FUNCDNAME__' is a Microsoft extension}}
+  eat_const_char_p("s" __FUNCSIG__); // expected-warning{{concatenation of predefined identifier '__FUNCSIG__' is a Microsoft extension}}
+
+  eat_const_char_p(__FUNCTION__ "s"); // expected-warning{{concatenation of predefined identifier '__FUNCTION__' is a Microsoft extension}}
+  eat_const_char_p(__FUNCDNAME__ "s"); // expected-warning{{concatenation of predefined identifier '__FUNCDNAME__' is a Microsoft extension}}
+  eat_const_char_p(__FUNCSIG__ "s"); // expected-warning{{concatenation of predefined identifier '__FUNCSIG__' is a Microsoft extension}}
+
+  eat_const_char_p("s" __FUNCTION__ "s"); // expected-warning{{concatenation of predefined identifier '__FUNCTION__' is a Microsoft extension}}
+  eat_const_char_p("s" __FUNCDNAME__ "s"); // expected-warning{{concatenation of predefined identifier '__FUNCDNAME__' is a Microsoft extension}}
+  eat_const_char_p("s" __FUNCSIG__ "s"); // expected-warning{{concatenation of predefined identifier '__FUNCSIG__' is a Microsoft extension}}
+}
+
+void test_wide_concat() {
+  eat_const_wchar_p(L"s" L__FUNCTION__); // expected-warning{{concatenation of predefined identifier 'L__FUNCTION__' is a Microsoft extension}}
+  eat_const_wchar_p(L"s" L__FUNCSIG__); // expected-warning{{concatenation of predefined identifier 'L__FUNCSIG__' is a Microsoft extension}}
+
+  eat_const_wchar_p(L__FUNCTION__ L"s"); // expected-warning{{concatenation of predefined identifier 'L__FUNCTION__' is a Microsoft extension}}
+  eat_const_wchar_p(L__FUNCSIG__ L"s"); // expected-warning{{concatenation of predefined identifier 'L__FUNCSIG__' is a Microsoft extension}}
+
+  eat_const_wchar_p(L"s" L__FUNCTION__ L"s"); // expected-warning{{concatenation of predefined identifier 'L__FUNCTION__' is a Microsoft extension}}
+  eat_const_wchar_p(L"s" L__FUNCSIG__ L"s"); // expected-warning{{concatenation of predefined identifier 'L__FUNCSIG__' is a Microsoft extension}}
+}
+
+const char* test_return() {
+  return __FUNCTION__ "s" __FUNCSIG__; // expected-warning{{concatenation of predefined identifier '__FUNCTION__' is a Microsoft extension}} \
+   // expected-warning{{concatenation of predefined identifier '__FUNCSIG__' is a Microsoft extension}}
+}
+
+void test_struct_init_fn() {
+  struct test_struct_init {
+const char* str;
+  } struct_init = { "struct: " __FUNCSIG__ }; // expected-warning{{concatenation of predefined identifier '__FUNCSIG__' is a Microsoft extension}}
 }
Index: clang/lib/Sema/SemaExpr.cpp
===
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -1882,6 +1882,27 @@
   ContainsUnexpandedParameterPack, ResultIndex);
 }
 
+static PredefinedExpr::IdentKind getPredefinedExprKind(tok::TokenKind Kind) {
+  switch (Kind) {
+  default:
+llvm_unreachable("unexpected TokenKind");
+  case tok::kw___func__:
+return PredefinedExpr::Func; // [C99 6.4.2.2]
+  case tok::kw___FUNCTION__:
+return PredefinedExpr::Function;
+  case tok::kw___F

[PATCH] D134475: [Clang] Add support for [[msvc::constexpr]] C++11 attribute

2023-07-07 Thread Richard Dzenis via Phabricator via cfe-commits
RIscRIpt updated this revision to Diff 538026.
RIscRIpt added a comment.

Rebased onto main


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134475

Files:
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td
  clang/include/clang/Basic/DiagnosticASTKinds.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/AST/ExprConstant.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/lib/Sema/SemaStmtAttr.cpp
  clang/test/AST/msvc-attrs-invalid.cpp
  clang/test/AST/msvc-attrs.cpp
  clang/test/AST/msvc-constexpr-new.cpp
  clang/test/Misc/pragma-attribute-supported-attributes-list.test

Index: clang/test/Misc/pragma-attribute-supported-attributes-list.test
===
--- clang/test/Misc/pragma-attribute-supported-attributes-list.test
+++ clang/test/Misc/pragma-attribute-supported-attributes-list.test
@@ -84,6 +84,7 @@
 // CHECK-NEXT: LoaderUninitialized (SubjectMatchRule_variable_is_global)
 // CHECK-NEXT: Lockable (SubjectMatchRule_record)
 // CHECK-NEXT: MIGServerRoutine (SubjectMatchRule_function, SubjectMatchRule_objc_method, SubjectMatchRule_block)
+// CHECK-NEXT: MSConstexpr (SubjectMatchRule_function)
 // CHECK-NEXT: MSStruct (SubjectMatchRule_record)
 // CHECK-NEXT: MaybeUndef (SubjectMatchRule_variable_is_parameter)
 // CHECK-NEXT: MicroMips (SubjectMatchRule_function)
Index: clang/test/AST/msvc-constexpr-new.cpp
===
--- /dev/null
+++ clang/test/AST/msvc-constexpr-new.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fms-extensions -std=c++20 -ast-dump %s | FileCheck %s
+
+// CHECK: used operator new
+// CHECK: MSConstexprAttr 0x{{[0-9a-f]+}} 
+[[nodiscard]] [[msvc::constexpr]] inline void* __cdecl operator new(decltype(sizeof(void*)), void* p) noexcept { return p; }
+
+// CHECK: used constexpr construct_at
+// CHECK: AttributedStmt 0x{{[0-9a-f]+}} 
+// CHECK-NEXT: MSConstexprAttr 0x{{[0-9a-f]+}} 
+// CHECK-NEXT: ReturnStmt 0x{{[0-9a-f]+}} 
+constexpr int* construct_at(int* p, int v) { [[msvc::constexpr]] return ::new (p) int(v); }
+
+constexpr bool check_construct_at() { int x; return *construct_at(&x, 42) == 42; }
+
+static_assert(check_construct_at());
Index: clang/test/AST/msvc-attrs.cpp
===
--- /dev/null
+++ clang/test/AST/msvc-attrs.cpp
@@ -0,0 +1,59 @@
+// RUN: %clang_cc1 -fms-extensions -std=c++20 -ast-dump %s | FileCheck %s
+
+// [[msvc::constexpr]] tests
+
+// MSConstexprDocs (1)
+// CHECK: used f1 'bool ()'
+// CHECK: MSConstexprAttr 0x{{[0-9a-f]+}} 
+[[msvc::constexpr]] bool f1() { return true; }
+
+// MSConstexprDocs (2)
+// CHECK: used constexpr f2 'bool ()'
+// CHECK: AttributedStmt 0x{{[0-9a-f]+}} 
+// CHECK-NEXT: MSConstexprAttr 0x{{[0-9a-f]+}} 
+// CHECK-NEXT: ReturnStmt 0x{{[0-9a-f]+}} 
+constexpr bool f2() { [[msvc::constexpr]] return f1(); }
+
+static_assert(f2());
+
+constexpr bool f3() { [[msvc::constexpr]] return f1() || f1() && f1(); }
+static_assert(f3());
+
+[[msvc::constexpr]] int f4(int x) { [[msvc::constexpr]] return x > 1 ? 1 + f4(x / 2) : 0; }
+constexpr bool f5() { [[msvc::constexpr]] return f4(32) == 5; }
+static_assert(f5());
+
+[[msvc::constexpr]] int f6(int x)
+{
+switch (x)
+{
+case 42: return 1337;
+default:
+ if (x < 0) [[msvc::constexpr]] return f4(-x);
+ else return x;
+}
+}
+
+constexpr bool f7() { [[msvc::constexpr]] return f6(f6(42) - 1337 + f6(-32) - 5 + (f6(1) ? f6(0) : f6(2))) == f6(0); }
+static_assert(f7());
+
+constexpr bool f8() { return true; }
+[[msvc::constexpr]] bool f9() { return f8(); }
+constexpr bool f10() { [[msvc::constexpr]] return f9(); }
+static_assert(f10());
+
+struct S1 {
+[[msvc::constexpr]] virtual bool vm() { return true; }
+constexpr bool cm() { [[msvc::constexpr]] return vm(); }
+};
+static_assert(S1{}.cm());
+
+/*
+// TODO: Add support for [[msvc::constexpr]] constructor
+struct S2 {
+[[msvc::constexpr]] S2() {}
+[[msvc::constexpr]] bool value() { return true; }
+static constexpr bool check() { [[msvc::constexpr]] return S2{}.value(); }
+};
+static_assert(S2::check());
+*/
Index: clang/test/AST/msvc-attrs-invalid.cpp
===
--- /dev/null
+++ clang/test/AST/msvc-attrs-invalid.cpp
@@ -0,0 +1,51 @@
+// RUN: %clang_cc1 -fms-extensions -std=c++20 -verify %s
+// RUN: %clang_cc1 -fms-extensions -std=c++17 -verify=cpp17 %s
+
+#if __cplusplus >= 202002L
+// Check explicitly invalid code
+
+void runtime() {} // expected-note {{declared here}}
+
+[[msvc::constexpr]] void f0() { runtime(); } // expected-error {{[[msvc::constexpr]] function never produces a constant expression}} \
+ // expected-note {{non-constexpr fun

[PATCH] D154509: [clang][analyzer] StdLibraryFunctionsChecker: Allow NULL buffer in `fread` and `fwrite` if size is zero.

2023-07-07 Thread Donát Nagy via Phabricator via cfe-commits
donat.nagy accepted this revision.
donat.nagy added a comment.
This revision is now accepted and ready to land.

LGTM.




Comment at: 
clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:413-414
+using ValueConstraint::ValueConstraint;
+ArgNo SizeArg1N;
+std::optional SizeArg2N;
+// This variable has a role when we negate the constraint.

What would you think about a `SmallVector<2>` for these? It would allow you to 
handle them with a (short) for loop instead of separate commands.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154509

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


[PATCH] D154693: [RISCV] Remote redundant _ta suffix in RVV intrinsics builtins. NFC

2023-07-07 Thread Yueh-Ting (eop) Chen via Phabricator via cfe-commits
eopXD created this revision.
eopXD added a reviewer: craig.topper.
Herald added subscribers: jobnoorman, luke, VincentWu, vkmr, frasercrmck, 
luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, 
PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, 
shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, 
arichardson.
Herald added a project: All.
eopXD requested review of this revision.
Herald added subscribers: cfe-commits, wangpc, MaskRay.
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D154693

Files:
  clang/lib/Sema/SemaChecking.cpp
  clang/lib/Support/RISCVVIntrinsicUtils.cpp


Index: clang/lib/Support/RISCVVIntrinsicUtils.cpp
===
--- clang/lib/Support/RISCVVIntrinsicUtils.cpp
+++ clang/lib/Support/RISCVVIntrinsicUtils.cpp
@@ -1080,10 +1080,9 @@
   } else {
 if (PolicyAttrs.isTUPolicy())
   appendPolicySuffix("_tu");
-else if (PolicyAttrs.isTAPolicy()) {
-  if (HasPolicy)
-BuiltinName += "_ta";
-} else
+else if (PolicyAttrs.isTAPolicy()) // no suffix needed
+  return;
+else
   llvm_unreachable("Unhandled policy condition");
   }
 }
Index: clang/lib/Sema/SemaChecking.cpp
===
--- clang/lib/Sema/SemaChecking.cpp
+++ clang/lib/Sema/SemaChecking.cpp
@@ -4697,24 +4697,24 @@
   case RISCV::BI__builtin_riscv_aes64ks1i_64:
 return SemaBuiltinConstantArgRange(TheCall, 1, 0, 10);
   // Check if value range for vxrm is in [0, 3]
-  case RISCVVector::BI__builtin_rvv_vaaddu_vv_ta:
-  case RISCVVector::BI__builtin_rvv_vaaddu_vx_ta:
-  case RISCVVector::BI__builtin_rvv_vaadd_vv_ta:
-  case RISCVVector::BI__builtin_rvv_vaadd_vx_ta:
-  case RISCVVector::BI__builtin_rvv_vasubu_vv_ta:
-  case RISCVVector::BI__builtin_rvv_vasubu_vx_ta:
-  case RISCVVector::BI__builtin_rvv_vasub_vv_ta:
-  case RISCVVector::BI__builtin_rvv_vasub_vx_ta:
-  case RISCVVector::BI__builtin_rvv_vsmul_vv_ta:
-  case RISCVVector::BI__builtin_rvv_vsmul_vx_ta:
-  case RISCVVector::BI__builtin_rvv_vssra_vv_ta:
-  case RISCVVector::BI__builtin_rvv_vssra_vx_ta:
-  case RISCVVector::BI__builtin_rvv_vssrl_vv_ta:
-  case RISCVVector::BI__builtin_rvv_vssrl_vx_ta:
-  case RISCVVector::BI__builtin_rvv_vnclip_wv_ta:
-  case RISCVVector::BI__builtin_rvv_vnclip_wx_ta:
-  case RISCVVector::BI__builtin_rvv_vnclipu_wv_ta:
-  case RISCVVector::BI__builtin_rvv_vnclipu_wx_ta:
+  case RISCVVector::BI__builtin_rvv_vaaddu_vv:
+  case RISCVVector::BI__builtin_rvv_vaaddu_vx:
+  case RISCVVector::BI__builtin_rvv_vaadd_vv:
+  case RISCVVector::BI__builtin_rvv_vaadd_vx:
+  case RISCVVector::BI__builtin_rvv_vasubu_vv:
+  case RISCVVector::BI__builtin_rvv_vasubu_vx:
+  case RISCVVector::BI__builtin_rvv_vasub_vv:
+  case RISCVVector::BI__builtin_rvv_vasub_vx:
+  case RISCVVector::BI__builtin_rvv_vsmul_vv:
+  case RISCVVector::BI__builtin_rvv_vsmul_vx:
+  case RISCVVector::BI__builtin_rvv_vssra_vv:
+  case RISCVVector::BI__builtin_rvv_vssra_vx:
+  case RISCVVector::BI__builtin_rvv_vssrl_vv:
+  case RISCVVector::BI__builtin_rvv_vssrl_vx:
+  case RISCVVector::BI__builtin_rvv_vnclip_wv:
+  case RISCVVector::BI__builtin_rvv_vnclip_wx:
+  case RISCVVector::BI__builtin_rvv_vnclipu_wv:
+  case RISCVVector::BI__builtin_rvv_vnclipu_wx:
 return SemaBuiltinConstantArgRange(TheCall, 2, 0, 3);
   case RISCVVector::BI__builtin_rvv_vaaddu_vv_tu:
   case RISCVVector::BI__builtin_rvv_vaaddu_vx_tu:


Index: clang/lib/Support/RISCVVIntrinsicUtils.cpp
===
--- clang/lib/Support/RISCVVIntrinsicUtils.cpp
+++ clang/lib/Support/RISCVVIntrinsicUtils.cpp
@@ -1080,10 +1080,9 @@
   } else {
 if (PolicyAttrs.isTUPolicy())
   appendPolicySuffix("_tu");
-else if (PolicyAttrs.isTAPolicy()) {
-  if (HasPolicy)
-BuiltinName += "_ta";
-} else
+else if (PolicyAttrs.isTAPolicy()) // no suffix needed
+  return;
+else
   llvm_unreachable("Unhandled policy condition");
   }
 }
Index: clang/lib/Sema/SemaChecking.cpp
===
--- clang/lib/Sema/SemaChecking.cpp
+++ clang/lib/Sema/SemaChecking.cpp
@@ -4697,24 +4697,24 @@
   case RISCV::BI__builtin_riscv_aes64ks1i_64:
 return SemaBuiltinConstantArgRange(TheCall, 1, 0, 10);
   // Check if value range for vxrm is in [0, 3]
-  case RISCVVector::BI__builtin_rvv_vaaddu_vv_ta:
-  case RISCVVector::BI__builtin_rvv_vaaddu_vx_ta:
-  case RISCVVector::BI__builtin_rvv_vaadd_vv_ta:
-  case RISCVVector::BI__builtin_rvv_vaadd_vx_ta:
-  case RISCVVector::BI__builtin_rvv_vasubu_vv_ta:
-  case RISCVVector::BI__builtin_rvv_vasubu_vx_ta:
-  case RISCVVector::BI__builtin_rvv_vasub_vv_ta:
-  case RISCVVector::BI__builtin_rvv_vasub_vx_ta:
-  case RISCVVector::BI__builtin_rvv_vsmul_vv_ta:
-  case RISCVVector::BI__builtin_rvv_vsmul_vx_ta

[PATCH] D70401: [RISCV] CodeGen of RVE and ilp32e/lp64e ABIs

2023-07-07 Thread Zixuan Wu via Phabricator via cfe-commits
zixuan-wu added inline comments.



Comment at: llvm/lib/Target/RISCV/RISCVFrameLowering.cpp:908
 
 static const MCPhysReg CSRegs[] = { RISCV::X1,  /* ra */
   RISCV::X5, RISCV::X6, RISCV::X7,  /* t0-t2 */

Hi, @wangpc it's hidden bug that out of range registers are saved/restored in 
prologue/epilogue


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70401

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


[PATCH] D140727: [XRay] Add initial support for loongarch64

2023-07-07 Thread WÁNG Xuěruì via Phabricator via cfe-commits
xen0n added inline comments.



Comment at: compiler-rt/lib/xray/xray_loongarch64.cpp:22-25
+  RN_T0 = 0xC,
+  RN_T1 = 0xD,
+  RN_RA = 0x1,
+  RN_SP = 0x3,

I think people usually just declare the register ABI names with decimal numbers 
for readability?

This is minor but I personally find it slightly distracting to have to think 
about what's `0xc` in decimal (that's the case even though I'm already very 
familiar with these kinds of thing). Not sure if others also prefer decimals 
though...



Comment at: compiler-rt/lib/xray/xray_loongarch64.cpp:32
+   uint32_t Imm) XRAY_NEVER_INSTRUMENT {
+  return (Opcode | Rj << 5 | Rd | Imm << 10);
+}

Parens not needed in this case. (If you want to enhance readability for those 
people having difficulties remembering precedence and associativeness of 
operators, you should instead put the parens around `Rj << 5` and `Imm << 
10`...)

I'd suggest re-ordering the operands too, to imitate the expected bit layout of 
the result.



Comment at: compiler-rt/lib/xray/xray_loongarch64.cpp:39
+   uint32_t Imm) XRAY_NEVER_INSTRUMENT {
+  return (Opcode | Rd | Imm << 5);
+}

Similarly here.



Comment at: compiler-rt/lib/xray/xray_loongarch64.cpp:42-47
+// Encode instructions in 2RI16 format, e.g. jirl.
+inline static uint32_t
+encodeInstruction2RI16(uint32_t Opcode, uint32_t Rd, uint32_t Rj,
+   uint32_t Imm) XRAY_NEVER_INSTRUMENT {
+  return (Opcode | Rj << 5 | Rd | Imm << 10);
+}

Does this look *very* similar to `encodeInstruction2RI12`? ;-)

Actually, if you don't bounds-check the operands, you only need one helper for 
each combination of slots involved. Check for example the `static uint32_t 
insn` implementation in my D138135, or [[ 
https://gitlab.com/qemu-project/qemu/-/blob/master/tcg/loongarch64/tcg-insn-defs.c.inc
 | the auto-generated encoding helpers for the QEMU TCG LoongArch64 port ]], 
for some alternative approaches.



Comment at: compiler-rt/lib/xray/xray_loongarch64.cpp:58
+  //   11 NOPs (44 bytes)
+  //   .tmpN
+  //

`.tmpN:` for it to not look like a directive?



Comment at: compiler-rt/lib/xray/xray_loongarch64.cpp:71
+  //   ori t1, t1, %abs_lo12(function_id);pass function id
+  //   jirlra, t0, 0 ;call Tracing hook
+  //   ld.dra, sp, 8 ;restore return address

All-lowercase i.e. `tracing` for consistency? Or am I missing something?



Comment at: compiler-rt/lib/xray/xray_loongarch64.cpp:73
+  //   ld.dra, sp, 8 ;restore return address
+  //   addi.d  sp, sp, 16;delete stack frame
+  //

I think idiomatically it's not "create/delete stack frame" but rather 
"(de-)allocate" or "setup/teardown"... anyway please fix the usage of articles 
(put the "the"'s properly) and also add a space after the `;` because it's 
usually aesthetically better.

This is all minor though, and it's not like people will misunderstand anything 
otherwise, but rather it's mostly just me pushing for more natural English 
usage.



Comment at: compiler-rt/lib/xray/xray_loongarch64.cpp:80
+  //
+  // When |Enable|==false, we set back the first instruction in the sled to be
+  //   B #48

("set back" happens to be an idiomatic phrase verb so I got confused here for 
~1 second, so I think it's probably easier to just avoid this coincidence.)



Comment at: compiler-rt/lib/xray/xray_trampoline_loongarch64.S:83
+  // a1=1 means that we are tracing an exit event
+  ori $a1, $zero, 1
+  // Function ID is in t1 (the first parameter).

Use pseudo-instruction for idiomatic expression of intent.



Comment at: llvm/lib/Target/LoongArch/LoongArchAsmPrinter.cpp:152-177
+  const int8_t NoopsInSledCount = 11;
+  // For loongarch64 we want to emit the following pattern:
+  //
+  // .Lxray_sled_beginN:
+  //   ALIGN
+  //   B .Lxray_sled_endN
+  //   11 NOP instructions (44 bytes)

We don't have to repeat the instruction pattern when we can just refer people 
to the source file containing this. Also the comment seems to be  explanation 
for the magic number 11, so it should probably come before the definition.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140727

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


[PATCH] D154696: [Clang] Diagnose jumps into statement expressions

2023-07-07 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin created this revision.
Herald added a project: All.
cor3ntin requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Such jumps are not allowed by GCC and allowing them
can lead to situations where we jumps into unevaluated
statements.

Fixes #63682


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D154696

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/JumpDiagnostics.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/test/CXX/stmt.stmt/stmt.select/stmt.if/p2.cpp
  clang/test/Sema/asm-goto.cpp
  clang/test/Sema/scope-check.c
  clang/test/SemaCXX/constant-expression-cxx14.cpp
  clang/test/SemaObjC/scope-check.m

Index: clang/test/SemaObjC/scope-check.m
===
--- clang/test/SemaObjC/scope-check.m
+++ clang/test/SemaObjC/scope-check.m
@@ -36,21 +36,20 @@
   } @finally {
 goto L7; // expected-error{{cannot jump}}
   }
-  
+
   goto L8;  // expected-error{{cannot jump}}
-  @try { 
+  @try {
   } @catch (A *c) {
   } @catch (B *c) {
   } @catch (C *c) { // expected-note {{jump bypasses initialization of @catch block}}
   L8: ;
   }
-  
+
   // rdar://6810106
   id X;
   goto L9;// expected-error{{cannot jump}}
-  goto L10;   // ok
-  @synchronized// expected-note {{jump bypasses initialization of @synchronized block}}
-  ( ({ L10: ; X; })) {
+  @synchronized (X)  // expected-note {{jump bypasses initialization of @synchronized block}}
+  {
   L9:
 ;
   }
Index: clang/test/SemaCXX/constant-expression-cxx14.cpp
===
--- clang/test/SemaCXX/constant-expression-cxx14.cpp
+++ clang/test/SemaCXX/constant-expression-cxx14.cpp
@@ -831,8 +831,9 @@
 case 0:
   return 0;
 
-  ({
-case 1: // expected-note {{not supported}}
+  ({  // expected-note {{jump enters a statement expression}}
+case 1:// expected-error {{cannot jump from switch statement to this case label}} \
+   // expected-note  {{not supported}}
   return 1;
   });
 }
Index: clang/test/Sema/scope-check.c
===
--- clang/test/Sema/scope-check.c
+++ clang/test/Sema/scope-check.c
@@ -65,7 +65,8 @@
 
   // Statement expressions.
   goto L3;   // expected-error {{cannot jump from this goto statement to its label}}
-  int Y = ({  int a[x];   // expected-note {{jump bypasses initialization of variable length array}}  
+  int Y = ({  int a[x];   // expected-note {{jump bypasses initialization of variable length array}} \
+  // expected-note {{jump enters a statement expression}}
L3: 4; });
   
   goto L4; // expected-error {{cannot jump from this goto statement to its label}}
@@ -107,25 +108,25 @@
4; })];
   L10:; // bad
   }
-  
+
   {
 // FIXME: Crashes goto checker.
 //goto L11;// ok
 //int A[({   L11: 4; })];
   }
-  
+
   {
 goto L12;
-
+
 int y = 4;   // fixme-warn: skips initializer.
   L12:
 ;
   }
-  
+
   // Statement expressions 2.
   goto L1; // expected-error {{cannot jump from this goto statement to its label}}
-  return x == ({
- int a[x];   // expected-note {{jump bypasses initialization of variable length array}}  
+  return x == ({ // expected-note {{jump enters a statement expression}}
+ int a[x];   // expected-note {{jump bypasses initialization of variable length array}}
L1:
  42; });
 }
@@ -232,3 +233,22 @@
 
 // rdar://9024687
 int test16(int [sizeof &&z]); // expected-error {{use of address-of-label extension outside of a function body}}
+
+void GH63682() {
+  {
+goto L; // expected-error {{cannot jump from this goto statement to its label}}
+(void)sizeof (int){({ L:; 1; })}; // expected-note {{jump enters a statement expression}}
+  }
+  {
+goto M; // expected-error {{cannot jump from this goto statement to its label}}
+(void)({ M:; 1; }); // expected-note {{jump enters a statement expression}}
+  }
+  {
+(void)({ goto N; 1; });  // ok
+N: ;
+  }
+  {
+(void)sizeof (int){({ goto O; 1; })}; // ok (not evaluated)
+O: ;
+  }
+}
Index: clang/test/Sema/asm-goto.cpp
===
--- clang/test/Sema/asm-goto.cpp
+++ clang/test/Sema/asm-goto.cpp
@@ -50,9 +50,10 @@
   // expected-error@+2 {{cannot jump from this asm goto statement to one of its possible targets}}
   // expected-error@+1 {{cannot jump from this asm goto statement to one of its possible targets}}
   asm volatile goto("testl %0, %0; jne %l1;" :: "r"(n)::label_true, loop);
-  // expected-note@+2 {{jump bypasses initialization of variable length array}}
-  // expected-note@+1 {{possible target of asm goto statement}}
-  return ({int a[n];label_true: 2;});
+  // expected-not

[PATCH] D154689: [clang] Correct calculation of MemberExpr's dependence

2023-07-07 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin added inline comments.



Comment at: clang/lib/AST/Expr.cpp:1760
 
+  // FIXME: remove remaining dependence computation to computeDependence().
+  auto Deps = E->getDependence();

Maybe we should do that now, by passing `TemplateArgs` to computeDependence?

Otherwise there is a good chance that fixme never gets fixed !


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154689

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


[PATCH] D154543: [llvm] Move StringExtras.h include from Error.h to Error.cpp

2023-07-07 Thread Elliot Goodrich via Phabricator via cfe-commits
IncludeGuardian updated this revision to Diff 538047.
IncludeGuardian added a comment.
Herald added a reviewer: jhenderson.
Herald added a reviewer: MaskRay.

Fix `XCOFFDump.cpp`


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

https://reviews.llvm.org/D154543

Files:
  clang/lib/Driver/ToolChain.cpp
  clang/lib/Driver/ToolChains/BareMetal.cpp
  llvm/include/llvm/Support/Error.h
  llvm/lib/Analysis/VectorUtils.cpp
  llvm/lib/Support/Error.cpp
  llvm/lib/Transforms/IPO/Internalize.cpp
  llvm/lib/Transforms/Scalar/MergeICmps.cpp
  llvm/lib/Transforms/Utils/MemoryOpRemark.cpp
  llvm/lib/Transforms/Utils/ModuleUtils.cpp
  llvm/tools/llvm-objdump/XCOFFDump.cpp
  llvm/unittests/Support/CompressionTest.cpp

Index: llvm/unittests/Support/CompressionTest.cpp
===
--- llvm/unittests/Support/CompressionTest.cpp
+++ llvm/unittests/Support/CompressionTest.cpp
@@ -12,99 +12,100 @@

 #include "llvm/Support/Compression.h"
 #include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Config/config.h"
 #include "llvm/Support/Error.h"
 #include "gtest/gtest.h"

 using namespace llvm;
 using namespace llvm::compression;

 namespace {

 #if LLVM_ENABLE_ZLIB
 static void testZlibCompression(StringRef Input, int Level) {
   SmallVector Compressed;
   SmallVector Uncompressed;
   zlib::compress(arrayRefFromStringRef(Input), Compressed, Level);

   // Check that uncompressed buffer is the same as original.
   Error E = zlib::decompress(Compressed, Uncompressed, Input.size());
   EXPECT_FALSE(std::move(E));
   EXPECT_EQ(Input, toStringRef(Uncompressed));

   // decompress with Z dispatches to zlib::decompress.
   E = compression::decompress(DebugCompressionType::Zlib, Compressed,
   Uncompressed, Input.size());
   EXPECT_FALSE(std::move(E));
   EXPECT_EQ(Input, toStringRef(Uncompressed));

   if (Input.size() > 0) {
 // Decompression fails if expected length is too short.
 E = zlib::decompress(Compressed, Uncompressed, Input.size() - 1);
 EXPECT_EQ("zlib error: Z_BUF_ERROR", llvm::toString(std::move(E)));
   }
 }

 TEST(CompressionTest, Zlib) {
   testZlibCompression("", zlib::DefaultCompression);

   testZlibCompression("hello, world!", zlib::NoCompression);
   testZlibCompression("hello, world!", zlib::BestSizeCompression);
   testZlibCompression("hello, world!", zlib::BestSpeedCompression);
   testZlibCompression("hello, world!", zlib::DefaultCompression);

   const size_t kSize = 1024;
   char BinaryData[kSize];
   for (size_t i = 0; i < kSize; ++i)
 BinaryData[i] = i & 255;
   StringRef BinaryDataStr(BinaryData, kSize);

   testZlibCompression(BinaryDataStr, zlib::NoCompression);
   testZlibCompression(BinaryDataStr, zlib::BestSizeCompression);
   testZlibCompression(BinaryDataStr, zlib::BestSpeedCompression);
   testZlibCompression(BinaryDataStr, zlib::DefaultCompression);
 }
 #endif

 #if LLVM_ENABLE_ZSTD
 static void testZstdCompression(StringRef Input, int Level) {
   SmallVector Compressed;
   SmallVector Uncompressed;
   zstd::compress(arrayRefFromStringRef(Input), Compressed, Level);

   // Check that uncompressed buffer is the same as original.
   Error E = zstd::decompress(Compressed, Uncompressed, Input.size());
   EXPECT_FALSE(std::move(E));
   EXPECT_EQ(Input, toStringRef(Uncompressed));

   // decompress with Zstd dispatches to zstd::decompress.
   E = compression::decompress(DebugCompressionType::Zstd, Compressed,
   Uncompressed, Input.size());
   EXPECT_FALSE(std::move(E));
   EXPECT_EQ(Input, toStringRef(Uncompressed));

   if (Input.size() > 0) {
 // Decompression fails if expected length is too short.
 E = zstd::decompress(Compressed, Uncompressed, Input.size() - 1);
 EXPECT_EQ("Destination buffer is too small", llvm::toString(std::move(E)));
   }
 }

 TEST(CompressionTest, Zstd) {
   testZstdCompression("", zstd::DefaultCompression);

   testZstdCompression("hello, world!", zstd::NoCompression);
   testZstdCompression("hello, world!", zstd::BestSizeCompression);
   testZstdCompression("hello, world!", zstd::BestSpeedCompression);
   testZstdCompression("hello, world!", zstd::DefaultCompression);

   const size_t kSize = 1024;
   char BinaryData[kSize];
   for (size_t i = 0; i < kSize; ++i)
 BinaryData[i] = i & 255;
   StringRef BinaryDataStr(BinaryData, kSize);

   testZstdCompression(BinaryDataStr, zstd::NoCompression);
   testZstdCompression(BinaryDataStr, zstd::BestSizeCompression);
   testZstdCompression(BinaryDataStr, zstd::BestSpeedCompression);
Index: llvm/tools/llvm-objdump/XCOFFDump.cpp
===
--- llvm/tools/llvm-objdump/XCOFFDump.cpp
+++ llvm/tools/llvm-objdump/XCOFFDump.cpp
@@ -14,11 +14,12 @@
 #include "XCOFFDump.h"

 #include "llvm-objdump.h"
+#include "llvm/ADT/StringExtras.h"
 #include "llvm/Demangle/Demangl

[PATCH] D154689: [clang] Correct calculation of MemberExpr's dependence

2023-07-07 Thread Mariya Podchishchaeva via Phabricator via cfe-commits
Fznamznon added inline comments.



Comment at: clang/lib/AST/Expr.cpp:1760
 
+  // FIXME: remove remaining dependence computation to computeDependence().
+  auto Deps = E->getDependence();

cor3ntin wrote:
> Maybe we should do that now, by passing `TemplateArgs` to computeDependence?
> 
> Otherwise there is a good chance that fixme never gets fixed !
`computeDependence` is called by the constructor of `MemberExpr` which doesn't 
accept template augments. In order to do that, I would need to modify the 
constructor of `MemberExpr`.
Is it still reasonable to do as a part of this fix?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154689

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


[PATCH] D154689: [clang] Correct calculation of MemberExpr's dependence

2023-07-07 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin added inline comments.



Comment at: clang/lib/AST/Expr.cpp:1760
 
+  // FIXME: remove remaining dependence computation to computeDependence().
+  auto Deps = E->getDependence();

Fznamznon wrote:
> cor3ntin wrote:
> > Maybe we should do that now, by passing `TemplateArgs` to computeDependence?
> > 
> > Otherwise there is a good chance that fixme never gets fixed !
> `computeDependence` is called by the constructor of `MemberExpr` which 
> doesn't accept template augments. In order to do that, I would need to modify 
> the constructor of `MemberExpr`.
> Is it still reasonable to do as a part of this fix?
Oh, i missed that the fixme is pre-existing, NVM then, i think you can leave it 
as-is. Sorry!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154689

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


[PATCH] D153954: [WIP][clang][analyzer] Relax alpha.cplusplus.EnumCastOutOfRange checker

2023-07-07 Thread Donát Nagy via Phabricator via cfe-commits
donat.nagy added a comment.

I think the old "report when the value stored in an enum type is not equal to 
one of the enumerators" behavior would be useful as an opt-in checker that 
could be adopted by some projects; while the new "relaxed" version is too bland 
to be really useful. I'd suggest keeping the old behavior in the general case, 
eliminating the "obvious" false positives like `std::byte` (don't report types 
that have no enumerators) and moving this checker towards the optin group.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153954

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


[PATCH] D70401: [RISCV] CodeGen of RVE and ilp32e/lp64e ABIs

2023-07-07 Thread Wang Pengcheng via Phabricator via cfe-commits
wangpc added inline comments.



Comment at: llvm/lib/Target/RISCV/RISCVFrameLowering.cpp:908
 
 static const MCPhysReg CSRegs[] = { RISCV::X1,  /* ra */
   RISCV::X5, RISCV::X6, RISCV::X7,  /* t0-t2 */

zixuan-wu wrote:
> Hi, @wangpc it's hidden bug that out of range registers are saved/restored in 
> prologue/epilogue
Thanks! We don't need to save X16-X31 for interrupt functions.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70401

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


[PATCH] D153469: [dataflow] Replace most BoolValue subclasses with references to Formula (and AtomicBoolValue => Atom and BoolValue => Formula where appropriate)

2023-07-07 Thread Mikael Holmén via Phabricator via cfe-commits
uabelho added inline comments.



Comment at: clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h:532
+  void addToFlowCondition(const Formula &);
+  LLVM_DEPRECATED("Use Formula version instead", "")
   void addToFlowCondition(BoolValue &Val);

There are still uses of this method in-tree. I get the following error (and 
many more) when I compile trunk now with -Werror:
```
../../clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp:148:9: 
error: 'addToFlowCondition' is deprecated: Use Formula version instead 
[-Werror,-Wdeprecated-declarations]
Env.addToFlowCondition(*Val);
^
../../clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h:532:3: 
note: 'addToFlowCondition' has been explicitly marked deprecated here
  LLVM_DEPRECATED("Use Formula version instead", "")
  ^
../include/llvm/Support/Compiler.h:155:50: note: expanded from macro 
'LLVM_DEPRECATED'
#define LLVM_DEPRECATED(MSG, FIX) __attribute__((deprecated(MSG, FIX)))
 ^
1 error generated.
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153469

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


[PATCH] D154688: [clang] Show verify prefix in error messages

2023-07-07 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 538058.

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

https://reviews.llvm.org/D154688

Files:
  clang/lib/Frontend/VerifyDiagnosticConsumer.cpp
  clang/test/Frontend/verify-any-file.c
  clang/test/Frontend/verify-fatal.c
  clang/test/Frontend/verify-ignore-unexpected.c
  clang/test/Frontend/verify-unknown-arg.c
  clang/test/Frontend/verify.c
  clang/test/Frontend/verify2.c
  clang/test/Frontend/verify3.c

Index: clang/test/Frontend/verify3.c
===
--- clang/test/Frontend/verify3.c
+++ clang/test/Frontend/verify3.c
@@ -7,7 +7,7 @@
 // expected-no-diagnostics
 // expected-note {{}}
 
-//  CHECK1: error: 'error' diagnostics seen but not expected:
+//  CHECK1: error: 'expected-error' diagnostics seen but not expected:
 // CHECK1-NEXT:   Line 8: expected directive cannot follow 'expected-no-diagnostics' directive
 // CHECK1-NEXT: 1 error generated.
 #endif
@@ -18,7 +18,7 @@
 // expected-warning@-1 {{X}}
 // expected-no-diagnostics
 
-//  CHECK2: error: 'error' diagnostics seen but not expected:
+//  CHECK2: error: 'expected-error' diagnostics seen but not expected:
 // CHECK2-NEXT:   Line 19: 'expected-no-diagnostics' directive cannot follow other expected directives
 // CHECK2-NEXT: 1 error generated.
 #endif
Index: clang/test/Frontend/verify2.c
===
--- clang/test/Frontend/verify2.c
+++ clang/test/Frontend/verify2.c
@@ -13,7 +13,7 @@
 // expected-error {{should be ignored}}
 
 //  CHECK: error: no expected directives found: consider use of 'expected-no-diagnostics'
-// CHECK-NEXT: error: 'error' diagnostics seen but not expected:
+// CHECK-NEXT: error: 'expected-error' diagnostics seen but not expected:
 // CHECK-NEXT:   Line 5: header
 // CHECK-NEXT:   Line 10: source
 // CHECK-NEXT: 3 errors generated.
@@ -31,9 +31,9 @@
 // expected-error@verify2.h:* {{header}}
 // expected-error@verify2.h:* {{unknown}}
 
-//  CHECK2: error: 'error' diagnostics expected but not seen:
+//  CHECK2: error: 'expected-error' diagnostics expected but not seen:
 // CHECK2-NEXT:   File {{.*}}verify2.h Line * (directive at {{.*}}verify2.c:32): unknown
-// CHECK2-NEXT: error: 'error' diagnostics seen but not expected:
+// CHECK2-NEXT: error: 'expected-error' diagnostics seen but not expected:
 // CHECK2-NEXT:   File {{.*}}verify2.c Line 10: source
 // CHECK2-NEXT: 2 errors generated.
 #endif
Index: clang/test/Frontend/verify.c
===
--- clang/test/Frontend/verify.c
+++ clang/test/Frontend/verify.c
@@ -48,15 +48,15 @@
 // This is encapsulated in "#if 0" so that the expected-* checks below
 // are not inadvertently included in the diagnostic checking!
 
-//  CHECK2: error: 'error' diagnostics expected but not seen:
+//  CHECK2: error: 'expected-error' diagnostics expected but not seen:
 // CHECK2-NEXT:   Line 41: define_error
 // CHECK2-NEXT:   Line 43: line_error
-// CHECK2-NEXT: error: 'error' diagnostics seen but not expected:
+// CHECK2-NEXT: error: 'expected-error' diagnostics seen but not expected:
 // CHECK2-NEXT:   Line 43: #line directive requires a positive integer argument
 // CHECK2-NEXT:   Line 44: AAA // expected-error {{[{][{]BBB[}][}]}} <- this shall be part of diagnostic
-// CHECK2-NEXT: error: 'warning' diagnostics expected but not seen:
+// CHECK2-NEXT: error: 'expected-warning' diagnostics expected but not seen:
 // CHECK2-NEXT:   Line 42: undef_error
-// CHECK2-NEXT: error: 'warning' diagnostics seen but not expected:
+// CHECK2-NEXT: error: 'expected-warning' diagnostics seen but not expected:
 // CHECK2-NEXT:   Line 42: extra tokens at end of #undef directive
 // CHECK2-NEXT:   Line 45: CCC // expected-warning {{[{][{]DDD[}][}]}} <- this shall be part of diagnostic
 // CHECK2-NEXT: 7 errors generated.
@@ -78,7 +78,7 @@
 # endif   // expected-note {{line_78}}
 #endif
 
-//  CHECK3: error: 'note' diagnostics expected but not seen:
+//  CHECK3: error: 'expected-note' diagnostics expected but not seen:
 // CHECK3-NEXT:   Line 67: line_67
 // CHECK3-NEXT:   Line 71: line_71
 // CHECK3-NEXT:   Line 72: line_72
@@ -91,9 +91,9 @@
 #ifdef TEST4
 #include "missing_header_file.include" // expected-error {{include_error}}
 
-//  CHECK4: error: 'error' diagnostics expected but not seen:
+//  CHECK4: error: 'expected-error' diagnostics expected but not seen:
 // CHECK4-NEXT:   Line 92: include_error
-// CHECK4-NEXT: error: 'error' diagnostics seen but not expected:
+// CHECK4-NEXT: error: 'expected-error' diagnostics seen but not expected:
 // CHECK4-NEXT:   Line 92: 'missing_header_file.include' file not found
 // CHECK4-NEXT: 2 errors generated.
 #endif
@@ -102,7 +102,7 @@
 #include "verify-directive.h"
 // expected-error@50 {{source file test}}
 
-//  CHECK5: error: 'error' diagnostics expected but not seen:
+//  

[PATCH] D70401: [RISCV] CodeGen of RVE and ilp32e/lp64e ABIs

2023-07-07 Thread Zixuan Wu via Phabricator via cfe-commits
zixuan-wu added inline comments.



Comment at: llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp:66
   return CSR_XLEN_F32_Interrupt_SaveList;
 return CSR_Interrupt_SaveList;
   }

Here also need adjust for rve.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70401

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


[PATCH] D153296: [AST] Stop evaluate constant expression if the condition expression which in switch statement contains errors

2023-07-07 Thread Yurong via Phabricator via cfe-commits
yronglin added a comment.

In D153296#4479718 , @hokein wrote:

> Thanks, this looks good.

Thanks for your review! I don't know why the reversion status still `Needs 
Review`, and the `libcxx ci` often fails to start.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153296

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


[PATCH] D154701: Overridden CXXMethodDecl::isVirtual() assertion failed before fully imported.

2023-07-07 Thread Ding Fei via Phabricator via cfe-commits
danix800 created this revision.
danix800 added a project: clang.
Herald added a project: All.
danix800 requested review of this revision.
Herald added a subscriber: cfe-commits.

For non-pure methods with no written `virtual`, `isVirtual()` tries to count 
size of overridden methods. For importing, size might not be correct before 
fully loaded.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D154701

Files:
  clang/lib/AST/DeclCXX.cpp
  clang/test/Analysis/ctu-astimport-virtual-assertion/Inputs/externalDefMap.txt
  clang/test/Analysis/ctu-astimport-virtual-assertion/Inputs/input.cpp
  clang/test/Analysis/ctu-astimport-virtual-assertion/Inputs/input.h
  clang/test/Analysis/ctu-astimport-virtual-assertion/main.cpp

Index: clang/test/Analysis/ctu-astimport-virtual-assertion/main.cpp
===
--- /dev/null
+++ clang/test/Analysis/ctu-astimport-virtual-assertion/main.cpp
@@ -0,0 +1,22 @@
+// RUN: rm -rf %t && mkdir %t
+// RUN: mkdir -p %t/ctudir
+
+// RUN: %clang --target=armv7a-linux-androideabi1 -c -x c++ \
+// RUN:   -mthumb -std=gnu++17 %p/Inputs/input.cpp -emit-ast \
+// RUN:   -o %t/ctudir/input.cpp.ast
+
+// RUN: cp %p/Inputs/externalDefMap.txt %t/ctudir/externalDefMap.txt
+
+// RUN: %clang_analyze_cc1 -triple thumbv7-unknown-linux-android1 \
+// RUN:   -std=gnu++17 \
+// RUN:   -analyzer-checker=core.DivideZero \
+// RUN:   -analyzer-opt-analyze-headers \
+// RUN:   -analyzer-config experimental-enable-naive-ctu-analysis=true \
+// RUN:   -analyzer-config display-ctu-progress=true \
+// RUN:   -analyzer-config ctu-dir=%t/ctudir \
+// RUN:   -fno-signed-char \
+// RUN:   -verify %s
+
+// expected-no-diagnostics
+
+#include "Inputs/input.h"
Index: clang/test/Analysis/ctu-astimport-virtual-assertion/Inputs/input.h
===
--- /dev/null
+++ clang/test/Analysis/ctu-astimport-virtual-assertion/Inputs/input.h
@@ -0,0 +1,25 @@
+#ifndef ART_COMPILER_OPTIMIZING_LOCATIONS_H_
+#define ART_COMPILER_OPTIMIZING_LOCATIONS_H_
+
+namespace std {
+
+template 
+class basic_ostream {};
+
+typedef basic_ostream ostream;
+
+} // namespace std
+
+namespace art {
+
+class Location;
+std::ostream &operator<<(std::ostream &os, const Location &location);
+
+class RegisterSet {
+public:
+  void Remove(std::ostream &OS, const Location &loc) { OS << loc; }
+};
+
+} // namespace art
+
+#endif // ART_COMPILER_OPTIMIZING_LOCATIONS_H_
Index: clang/test/Analysis/ctu-astimport-virtual-assertion/Inputs/input.cpp
===
--- /dev/null
+++ clang/test/Analysis/ctu-astimport-virtual-assertion/Inputs/input.cpp
@@ -0,0 +1,250 @@
+#include "input.h"
+
+typedef __SIZE_TYPE__ size_t;
+
+namespace std {
+template 
+struct integral_constant {
+  static constexpr _Tp value = __v;
+  typedef _Tp value_type;
+  typedef integral_constant<_Tp, __v> type;
+};
+using false_type = integral_constant;
+using true_type = integral_constant;
+
+template 
+struct is_base_of
+: public integral_constant {};
+
+template 
+struct is_enum : public integral_constant {};
+
+template 
+struct __hash_base {
+  typedef _Result result_type;
+  typedef _Arg argument_type;
+};
+
+template ::value>
+struct __hash_enum {
+private:
+  // Private rather than deleted to be non-trivially-copyable.
+  __hash_enum(__hash_enum &&);
+  ~__hash_enum();
+};
+
+template ::value>
+struct __underlying_type_impl {
+  using type = __underlying_type(_Tp);
+};
+
+template 
+struct __underlying_type_impl<_Tp, false> {};
+/// @endcond
+
+/// The underlying type of an enum.
+template 
+struct underlying_type : public __underlying_type_impl<_Tp> {};
+
+/// Primary class template hash, usable for enum types only.
+// Use with non-enum types still SFINAES.
+template 
+struct hash : __hash_enum<_Tp> {};
+
+// Helper struct for hash with enum types.
+template 
+struct __hash_enum<_Tp, true> : public __hash_base {
+  size_t operator()(_Tp __val) const noexcept {
+using __type = typename underlying_type<_Tp>::type;
+return hash<__type>{}(static_cast<__type>(__val));
+  }
+};
+
+template 
+struct hash<_Tp *> : public __hash_base {
+  size_t operator()(_Tp *__p) const noexcept {
+return reinterpret_cast(__p);
+  }
+};
+
+template 
+struct is_same : public false_type {};
+
+template 
+struct is_same<_Tp, _Tp> : public true_type {};
+
+template 
+struct enable_if {};
+
+template 
+struct enable_if {
+  typedef _Tp type;
+};
+
+} // namespace std
+
+namespace art {
+
+template 
+struct IntrusiveForwardListNode {};
+
+template 
+class IntrusiveForwardList;
+
+template 
+class IntrusiveForwardListIterator {
+private:
+  template 
+  friend
+  typename std::enable_if::value,
+  bool>::type
+  operator==(const IntrusiveForwardListIterator &lhs,
+ const IntrusiveForwardListIterator &rhs);
+};
+
+template 
+typename std::enable_if::value, bool>::ty

[PATCH] D105759: Implement P2361 Unevaluated string literals

2023-07-07 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin updated this revision to Diff 538073.
cor3ntin added a comment.

I removed the changes to attributes.
Nothing else changes except cxx_status/ReleaseNotes.

Unevaluated strings in attributes will be back (in a separate PR)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105759

Files:
  clang-tools-extra/test/clang-tidy/checkers/modernize/unary-static-assert.cpp
  clang/docs/ReleaseNotes.rst
  clang/include/clang/AST/Expr.h
  clang/include/clang/Basic/DiagnosticLexKinds.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Lex/LiteralSupport.h
  clang/include/clang/Parse/Parser.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/Expr.cpp
  clang/lib/Lex/LiteralSupport.cpp
  clang/lib/Lex/PPMacroExpansion.cpp
  clang/lib/Lex/Pragma.cpp
  clang/lib/Parse/ParseDeclCXX.cpp
  clang/lib/Parse/ParseExpr.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaInit.cpp
  clang/test/CXX/dcl.dcl/dcl.link/p2.cpp
  clang/test/CXX/dcl.dcl/p4-0x.cpp
  clang/test/FixIt/fixit-static-assert.cpp
  clang/test/SemaCXX/static-assert.cpp
  clang/www/cxx_status.html

Index: clang/www/cxx_status.html
===
--- clang/www/cxx_status.html
+++ clang/www/cxx_status.html
@@ -115,7 +115,9 @@
  
   Unevaluated strings
   https://wg21.link/P2361R6";>P2361R6
-  No
+  Clang 17 (Partial)
+Attributes don't require unevaluated string literals in this release
+  
  
  
   Add @, $, and ` to the basic character set
Index: clang/test/SemaCXX/static-assert.cpp
===
--- clang/test/SemaCXX/static-assert.cpp
+++ clang/test/SemaCXX/static-assert.cpp
@@ -29,13 +29,23 @@
 S s1; // expected-note {{in instantiation of template class 'S' requested here}}
 S s2;
 
-static_assert(false, L"\x"); // expected-error {{static assertion failed: L"\x"}}
-static_assert(false, u"\U000317FF"); // expected-error {{static assertion failed: u"\U000317FF"}}
-
-static_assert(false, u8"Ω"); // expected-error {{static assertion failed: u8"\316\251"}}
-static_assert(false, L"\u1234"); // expected-error {{static assertion failed: L"\x1234"}}
-static_assert(false, L"\x1ff" "0\x123" "fx\xf" "goop"); // expected-error {{static assertion failed: L"\x1FF""0\x123""fx\xFgoop"}}
-
+static_assert(false, L"\x"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}} \
+ // expected-error {{invalid escape sequence '\x' in an unevaluated string literal}}
+static_assert(false, u"\U000317FF"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
+// FIXME: render this as u8"\u03A9"
+static_assert(false, u8"Ω"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
+static_assert(false, L"\u1234"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
+static_assert(false, L"\x1ff"// expected-error {{an unevaluated string literal cannot have an encoding prefix}} \
+ // expected-error {{invalid escape sequence '\x1ff' in an unevaluated string literal}}
+ "0\x123"// expected-error {{invalid escape sequence '\x123' in an unevaluated string literal}}
+ "fx\xf" // expected-error {{invalid escape sequence '\xf' in an unevaluated string literal}}
+ "goop");
+
+static_assert(false, "\'\"\?\\\a\b\f\n\r\t\v"); // expected-error {{'"?\}}
+static_assert(true, "\xFF"); // expected-error {{invalid escape sequence '\xFF' in an unevaluated string literal}}
+static_assert(true, "\123"); // expected-error {{invalid escape sequence '\123' in an unevaluated string literal}}
+static_assert(true, "\pOh no, a Pascal string!"); // expected-warning {{unknown escape sequence '\p'}} \
+  // expected-error {{invalid escape sequence '\p' in an unevaluated string literal}}
 static_assert(false, R"(a
 \tb
 c
Index: clang/test/FixIt/fixit-static-assert.cpp
===
--- clang/test/FixIt/fixit-static-assert.cpp
+++ clang/test/FixIt/fixit-static-assert.cpp
@@ -11,8 +11,6 @@
 // String literal prefixes are good.
 static_assert(true && R"(RawString)");
 // CHECK-DAG: {[[@LINE-1]]:20-[[@LINE-1]]:22}:","
-static_assert(true && L"RawString");
-// CHECK-DAG: {[[@LINE-1]]:20-[[@LINE-1]]:22}:","
 
 static_assert(true);
 // CHECK-DAG: {[[@LINE-1]]:19-[[@LINE-1]]:19}:", \"\""
Index: clang/test/CXX/dcl.dcl/p4-0x.cpp
===
--- clang/test/CXX/dcl.dcl/p4-0x.cpp
+++ clang/test/CXX/dcl.dcl/p4-0x.cpp
@@ -18,4 +18,7 @@
 static_assert(T(), "");
 static_assert(U(), ""); // exp

[PATCH] D153296: [AST] Stop evaluate constant expression if the condition expression which in switch statement contains errors

2023-07-07 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment.

In D153296#4480141 , @yronglin wrote:

> In D153296#4479718 , @hokein wrote:
>
>> Thanks, this looks good.
>
> Thanks for your review! I don't know why the reversion status still `Needs 
> Review`, and the `libcxx ci` often fails to start.

I guess the `Needs Review` is probably caused by the previous "Requested 
Changes" by Aaron.
The `libcxx ci` failure doesn't seem to be relevant. I think we're all on the 
same page about the fix, it is fine to land it assuming that the `ninja 
check-clang` passes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153296

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


[PATCH] D154689: [clang] Correct calculation of MemberExpr's dependence

2023-07-07 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin accepted this revision.
cor3ntin added a comment.
This revision is now accepted and ready to land.

I think this makes sense and it implements richard's suggestion. 
However, it's missing a release note, can you add that before landing? 
Thanks


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154689

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


[PATCH] D153296: [AST] Stop evaluate constant expression if the condition expression which in switch statement contains errors

2023-07-07 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM. thank you!

In D153296#4480243 , @hokein wrote:

> In D153296#4480141 , @yronglin 
> wrote:
>
>> In D153296#4479718 , @hokein wrote:
>>
>>> Thanks, this looks good.
>>
>> Thanks for your review! I don't know why the reversion status still `Needs 
>> Review`, and the `libcxx ci` often fails to start.
>
> I guess the `Needs Review` is probably caused by the previous "Requested 
> Changes" by Aaron.

Correct.

> The `libcxx ci` failure doesn't seem to be relevant. I think we're all on the 
> same page about the fix, it is fine to land it assuming that the `ninja 
> check-clang` passes.

Agreed, the libcxx failure is unrelated.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153296

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


[PATCH] D105759: Implement P2361 Unevaluated string literals

2023-07-07 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM with a minor tweak to the wording on the status page, thank you!




Comment at: clang/www/cxx_status.html:118-120
+  Clang 17 
(Partial)
+Attributes don't require unevaluated string literals in this release
+  




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105759

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


[clang] 7cd1f3a - [analyzer] Remove deprecated analyzer-config options

2023-07-07 Thread Balazs Benics via cfe-commits

Author: Balazs Benics
Date: 2023-07-07T13:24:33+02:00
New Revision: 7cd1f3ad22e48924e7061539eb0acb0e0c49eb63

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

LOG: [analyzer] Remove deprecated analyzer-config options

The `consider-single-element-arrays-as-flexible-array-members` analyzer
option was deprecated in clang-16, and now removed from clang-17 as
promised in
https://releases.llvm.org/16.0.0/tools/clang/docs/ReleaseNotes.html#static-analyzer

This shouldn't change observable behavior.

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

Added: 


Modified: 
clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def
clang/lib/Frontend/CompilerInvocation.cpp
clang/lib/StaticAnalyzer/Core/MemRegion.cpp
clang/test/Analysis/analyzer-config.c
clang/test/Analysis/deprecated-flags-and-options.cpp

Removed: 




diff  --git a/clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def 
b/clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def
index acfbcf67b1b9d6..2fc825c2af9c36 100644
--- a/clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def
+++ b/clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def
@@ -326,15 +326,6 @@ ANALYZER_OPTION(bool, ShouldSupportSymbolicIntegerCasts,
 "Produce cast symbols for integral types.",
 false)
 
-ANALYZER_OPTION(
-bool, ShouldConsiderSingleElementArraysAsFlexibleArrayMembers,
-"consider-single-element-arrays-as-flexible-array-members",
-"Consider single element arrays as flexible array member candidates. "
-"This will prevent the analyzer from assuming that a single element array "
-"holds a single element. [DEPRECATED, removing in clang-17; "
-"use '-fstrict-flex-arrays=' instead]",
-true)
-
 ANALYZER_OPTION(
 bool, ShouldAssumeControlledEnvironment, "assume-controlled-environment",
 "Whether the analyzed application runs in a controlled environment. "

diff  --git a/clang/lib/Frontend/CompilerInvocation.cpp 
b/clang/lib/Frontend/CompilerInvocation.cpp
index dca8853f1c2047..50440e65a62251 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -1056,15 +1056,6 @@ static bool ParseAnalyzerArgs(AnalyzerOptions &Opts, 
ArgList &Args,
 
   A->claim();
   Opts.Config[key] = std::string(val);
-
-  // FIXME: Remove this hunk after clang-17 released.
-  constexpr auto SingleFAM =
-  "consider-single-element-arrays-as-flexible-array-members";
-  if (key == SingleFAM) {
-Diags.Report(diag::warn_analyzer_deprecated_option_with_alternative)
-<< SingleFAM << "clang-17"
-<< "-fstrict-flex-arrays=";
-  }
 }
   }
 

diff  --git a/clang/lib/StaticAnalyzer/Core/MemRegion.cpp 
b/clang/lib/StaticAnalyzer/Core/MemRegion.cpp
index 912ba71dd57381..f89e71a4f157b7 100644
--- a/clang/lib/StaticAnalyzer/Core/MemRegion.cpp
+++ b/clang/lib/StaticAnalyzer/Core/MemRegion.cpp
@@ -805,49 +805,46 @@ DefinedOrUnknownSVal 
MemRegionManager::getStaticSize(const MemRegion *MR,
 // We currently don't model flexible array members (FAMs), which are:
 //  - int array[]; of IncompleteArrayType
 //  - int array[0]; of ConstantArrayType with size 0
-//  - int array[1]; of ConstantArrayType with size 1 (*)
-// (*): Consider single element array object members as FAM candidates only
-//  if the consider-single-element-arrays-as-flexible-array-members
-//  analyzer option is true.
+//  - int array[1]; of ConstantArrayType with size 1
 // https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
-const auto isFlexibleArrayMemberCandidate = [this,
- &SVB](QualType Ty) -> bool {
-  const ArrayType *AT = Ctx.getAsArrayType(Ty);
+const auto isFlexibleArrayMemberCandidate =
+[this](const ArrayType *AT) -> bool {
   if (!AT)
 return false;
-  if (isa(AT))
-return true;
 
-  if (const auto *CAT = dyn_cast(AT)) {
-using FAMKind = LangOptions::StrictFlexArraysLevelKind;
-const FAMKind StrictFlexArraysLevel =
+  auto IsIncompleteArray = [](const ArrayType *AT) {
+return isa(AT);
+  };
+  auto IsArrayOfZero = [](const ArrayType *AT) {
+const auto *CAT = dyn_cast(AT);
+return CAT && CAT->getSize() == 0;
+  };
+  auto IsArrayOfOne = [](const ArrayType *AT) {
+const auto *CAT = dyn_cast(AT);
+return CAT && CAT->getSize() == 1;
+  };
+
+  using FAMKind = LangOptions::StrictFlexArraysLevelKind;
+  const FAMKind StrictFlexArraysLevel =
   Ctx.getLangOpts().getStrictFlexArraysLevel();
-const AnalyzerOptions &Opts = SVB.getAnalyzerOptions();
-co

[PATCH] D154481: [analyzer] Remove deprecated analyzer-config options

2023-07-07 Thread Balázs Benics 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 rG7cd1f3ad22e4: [analyzer] Remove deprecated analyzer-config 
options (authored by steakhal).

Changed prior to commit:
  https://reviews.llvm.org/D154481?vs=537254&id=538076#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154481

Files:
  clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/lib/StaticAnalyzer/Core/MemRegion.cpp
  clang/test/Analysis/analyzer-config.c
  clang/test/Analysis/deprecated-flags-and-options.cpp

Index: clang/test/Analysis/deprecated-flags-and-options.cpp
===
--- clang/test/Analysis/deprecated-flags-and-options.cpp
+++ clang/test/Analysis/deprecated-flags-and-options.cpp
@@ -1,6 +1,3 @@
-// RUN: %clang_analyze_cc1 -analyzer-checker=core %s 2>&1 \
-// RUN: | FileCheck %s --check-prefixes=CHECK
-
 // RUN: not %clang_analyze_cc1 -analyzer-checker=core -analyzer-store=region %s 2>&1 \
 // RUN: | FileCheck %s --check-prefixes=DEPRECATED-STORE
 // DEPRECATED-STORE: error: unknown argument: '-analyzer-store=region'
@@ -9,16 +6,9 @@
 // RUN: | FileCheck %s --check-prefixes=DEPRECATED-NESTED-BLOCKS
 // DEPRECATED-NESTED-BLOCKS: error: unknown argument: '-analyzer-opt-analyze-nested-blocks'
 
-// RUN: %clang_analyze_cc1 -analyzer-checker=core -analyzer-config consider-single-element-arrays-as-flexible-array-members=true %s 2>&1 \
-// RUN: | FileCheck %s --check-prefixes=CHECK,DEPRECATED-SINGLE-ELEM-FAM
-// DEPRECATED-SINGLE-ELEM-FAM: warning: analyzer option 'consider-single-element-arrays-as-flexible-array-members' is deprecated. This flag will be removed in clang-17, and passing this option will be an error. Use '-fstrict-flex-arrays=' instead.
+// RUN: not %clang_analyze_cc1 -analyzer-checker=core -analyzer-config consider-single-element-arrays-as-flexible-array-members=true %s 2>&1 \
+// RUN: | FileCheck %s --check-prefixes=DEPRECATED-SINGLE-ELEM-FAM
+// DEPRECATED-SINGLE-ELEM-FAM: error: unknown analyzer-config 'consider-single-element-arrays-as-flexible-array-members'
 
-// RUN: %clang_analyze_cc1 -analyzer-config-help 2>&1 \
-// RUN:   | FileCheck %s --check-prefixes=CHECK-HELP
-// CHECK-HELP:  [DEPRECATED, removing in clang-17; use '-fstrict-flex-arrays='
-// CHECK-HELP-NEXT: instead] (default: true)
 
-int empty(int x) {
-  // CHECK: warning: Division by zero
-  return x ? 0 : 0 / x;
-}
+void empty() {}
Index: clang/test/Analysis/analyzer-config.c
===
--- clang/test/Analysis/analyzer-config.c
+++ clang/test/Analysis/analyzer-config.c
@@ -33,7 +33,6 @@
 // CHECK-NEXT: cfg-rich-constructors = true
 // CHECK-NEXT: cfg-scopes = false
 // CHECK-NEXT: cfg-temporary-dtors = true
-// CHECK-NEXT: consider-single-element-arrays-as-flexible-array-members = true
 // CHECK-NEXT: core.CallAndMessage:ArgInitializedness = true
 // CHECK-NEXT: core.CallAndMessage:ArgPointeeInitializedness = false
 // CHECK-NEXT: core.CallAndMessage:CXXDeallocationArg = true
Index: clang/lib/StaticAnalyzer/Core/MemRegion.cpp
===
--- clang/lib/StaticAnalyzer/Core/MemRegion.cpp
+++ clang/lib/StaticAnalyzer/Core/MemRegion.cpp
@@ -805,49 +805,46 @@
 // We currently don't model flexible array members (FAMs), which are:
 //  - int array[]; of IncompleteArrayType
 //  - int array[0]; of ConstantArrayType with size 0
-//  - int array[1]; of ConstantArrayType with size 1 (*)
-// (*): Consider single element array object members as FAM candidates only
-//  if the consider-single-element-arrays-as-flexible-array-members
-//  analyzer option is true.
+//  - int array[1]; of ConstantArrayType with size 1
 // https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
-const auto isFlexibleArrayMemberCandidate = [this,
- &SVB](QualType Ty) -> bool {
-  const ArrayType *AT = Ctx.getAsArrayType(Ty);
+const auto isFlexibleArrayMemberCandidate =
+[this](const ArrayType *AT) -> bool {
   if (!AT)
 return false;
-  if (isa(AT))
-return true;
 
-  if (const auto *CAT = dyn_cast(AT)) {
-using FAMKind = LangOptions::StrictFlexArraysLevelKind;
-const FAMKind StrictFlexArraysLevel =
+  auto IsIncompleteArray = [](const ArrayType *AT) {
+return isa(AT);
+  };
+  auto IsArrayOfZero = [](const ArrayType *AT) {
+const auto *CAT = dyn_cast(AT);
+return CAT && CAT->getSize() == 0;
+  };
+  auto IsArrayOfOne = [](const ArrayType *AT) {
+const auto *CAT = dyn_cast(AT);
+return CAT && CAT->getSize() == 1;
+  };
+
+  using FAMKind = LangOptions::StrictFlex

[clang-tools-extra] 95f5096 - Implement P2361 Unevaluated string literals

2023-07-07 Thread Corentin Jabot via cfe-commits

Author: Corentin Jabot
Date: 2023-07-07T13:30:27+02:00
New Revision: 95f50964fbf59dc6394898c0719ce8772cc24d25

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

LOG: Implement P2361 Unevaluated string literals

This patch proposes to handle in an uniform fashion
the parsing of strings that are never evaluated,
in asm statement, static assert, attrributes, extern,
etc.

Unevaluated strings are UTF-8 internally and so currently
behave as narrow strings, but these things will diverge with
D93031.

The big question both for this patch and the P2361 paper
is whether we risk breaking code by disallowing
encoding prefixes in this context.
I hope this patch may allow to gather some data on that.

Future work:
Improve the rendering of unicode characters, line break
and so forth in static-assert messages

Reviewed By: aaron.ballman, shafik

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

Added: 


Modified: 
clang-tools-extra/test/clang-tidy/checkers/modernize/unary-static-assert.cpp
clang/docs/ReleaseNotes.rst
clang/include/clang/AST/Expr.h
clang/include/clang/Basic/DiagnosticLexKinds.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Lex/LiteralSupport.h
clang/include/clang/Parse/Parser.h
clang/include/clang/Sema/Sema.h
clang/lib/AST/Expr.cpp
clang/lib/Lex/LiteralSupport.cpp
clang/lib/Lex/PPMacroExpansion.cpp
clang/lib/Lex/Pragma.cpp
clang/lib/Parse/ParseDeclCXX.cpp
clang/lib/Parse/ParseExpr.cpp
clang/lib/Sema/SemaDeclCXX.cpp
clang/lib/Sema/SemaExpr.cpp
clang/lib/Sema/SemaExprCXX.cpp
clang/lib/Sema/SemaInit.cpp
clang/test/CXX/dcl.dcl/dcl.link/p2.cpp
clang/test/CXX/dcl.dcl/p4-0x.cpp
clang/test/FixIt/fixit-static-assert.cpp
clang/test/SemaCXX/static-assert.cpp
clang/www/cxx_status.html

Removed: 




diff  --git 
a/clang-tools-extra/test/clang-tidy/checkers/modernize/unary-static-assert.cpp 
b/clang-tools-extra/test/clang-tidy/checkers/modernize/unary-static-assert.cpp
index 97ad94834cd0e6..74b4209505f97a 100644
--- 
a/clang-tools-extra/test/clang-tidy/checkers/modernize/unary-static-assert.cpp
+++ 
b/clang-tools-extra/test/clang-tidy/checkers/modernize/unary-static-assert.cpp
@@ -7,9 +7,6 @@ void f_textless(int a) {
   static_assert(sizeof(a) <= 10, "");
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use unary 'static_assert' when 
the string literal is an empty string [modernize-unary-static-assert]
   // CHECK-FIXES: {{^}}  static_assert(sizeof(a) <= 10 );{{$}}
-  static_assert(sizeof(a) <= 12, L"");
-  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use unary 'static_assert' when
-  // CHECK-FIXES: {{^}}  static_assert(sizeof(a) <= 12 );{{$}}
   FOO
   // CHECK-FIXES: {{^}}  FOO{{$}}
   static_assert(sizeof(a) <= 17, MSG);

diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 79550f79cc36b5..8672b483cf836b 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -135,6 +135,8 @@ C++2c Feature Support
 ^
 - Compiler flags ``-std=c++2c`` and ``-std=gnu++2c`` have been added for 
experimental C++2c implementation work.
 - Implemented `P2738R1: constexpr cast from void* 
`_.
+- Partially implemented `P2361R6: constexpr cast from void* 
`_.
+  The changes to attributes declarations are not part of this release.
 
 Resolutions to C++ Defect Reports
 ^

diff  --git a/clang/include/clang/AST/Expr.h b/clang/include/clang/AST/Expr.h
index 34aa63658d5017..661a8a7175ca88 100644
--- a/clang/include/clang/AST/Expr.h
+++ b/clang/include/clang/AST/Expr.h
@@ -1804,7 +1804,7 @@ class StringLiteral final
   /// * An array of getByteLength() char used to store the string data.
 
 public:
-  enum StringKind { Ordinary, Wide, UTF8, UTF16, UTF32 };
+  enum StringKind { Ordinary, Wide, UTF8, UTF16, UTF32, Unevaluated };
 
 private:
   unsigned numTrailingObjects(OverloadToken) const { return 1; }
@@ -1866,7 +1866,7 @@ class StringLiteral final
 unsigned CharByteWidth);
 
   StringRef getString() const {
-assert(getCharByteWidth() == 1 &&
+assert((isUnevaluated() || getCharByteWidth() == 1) &&
"This function is used in places that assume strings use char");
 return StringRef(getStrDataAsChar(), getByteLength());
   }
@@ -1906,6 +1906,7 @@ class StringLiteral final
   bool isUTF8() const { return getKind() == UTF8; }
   bool isUTF16() const { return getKind() == UTF16; }
   bool isUTF32() const { return getKind() == UTF32; }
+  bool isUnevaluated() const { return getKind() == Unevaluated; }
   bool isPascal() const { return StringLiteralBits.IsPascal; }
 
   bool containsNonAscii() const {

[PATCH] D105759: Implement P2361 Unevaluated string literals

2023-07-07 Thread Corentin Jabot 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 rG95f50964fbf5: Implement P2361 Unevaluated string literals 
(authored by cor3ntin).

Changed prior to commit:
  https://reviews.llvm.org/D105759?vs=538073&id=538078#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105759

Files:
  clang-tools-extra/test/clang-tidy/checkers/modernize/unary-static-assert.cpp
  clang/docs/ReleaseNotes.rst
  clang/include/clang/AST/Expr.h
  clang/include/clang/Basic/DiagnosticLexKinds.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Lex/LiteralSupport.h
  clang/include/clang/Parse/Parser.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/Expr.cpp
  clang/lib/Lex/LiteralSupport.cpp
  clang/lib/Lex/PPMacroExpansion.cpp
  clang/lib/Lex/Pragma.cpp
  clang/lib/Parse/ParseDeclCXX.cpp
  clang/lib/Parse/ParseExpr.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaInit.cpp
  clang/test/CXX/dcl.dcl/dcl.link/p2.cpp
  clang/test/CXX/dcl.dcl/p4-0x.cpp
  clang/test/FixIt/fixit-static-assert.cpp
  clang/test/SemaCXX/static-assert.cpp
  clang/www/cxx_status.html

Index: clang/www/cxx_status.html
===
--- clang/www/cxx_status.html
+++ clang/www/cxx_status.html
@@ -115,7 +115,12 @@
  
   Unevaluated strings
   https://wg21.link/P2361R6";>P2361R6
-  No
+  
+
+  Clang 17 (Partial)
+  Attributes arguments don't yet parse as unevaluated string literals.
+
+  
  
  
   Add @, $, and ` to the basic character set
Index: clang/test/SemaCXX/static-assert.cpp
===
--- clang/test/SemaCXX/static-assert.cpp
+++ clang/test/SemaCXX/static-assert.cpp
@@ -29,13 +29,23 @@
 S s1; // expected-note {{in instantiation of template class 'S' requested here}}
 S s2;
 
-static_assert(false, L"\x"); // expected-error {{static assertion failed: L"\x"}}
-static_assert(false, u"\U000317FF"); // expected-error {{static assertion failed: u"\U000317FF"}}
-
-static_assert(false, u8"Ω"); // expected-error {{static assertion failed: u8"\316\251"}}
-static_assert(false, L"\u1234"); // expected-error {{static assertion failed: L"\x1234"}}
-static_assert(false, L"\x1ff" "0\x123" "fx\xf" "goop"); // expected-error {{static assertion failed: L"\x1FF""0\x123""fx\xFgoop"}}
-
+static_assert(false, L"\x"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}} \
+ // expected-error {{invalid escape sequence '\x' in an unevaluated string literal}}
+static_assert(false, u"\U000317FF"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
+// FIXME: render this as u8"\u03A9"
+static_assert(false, u8"Ω"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
+static_assert(false, L"\u1234"); // expected-error {{an unevaluated string literal cannot have an encoding prefix}}
+static_assert(false, L"\x1ff"// expected-error {{an unevaluated string literal cannot have an encoding prefix}} \
+ // expected-error {{invalid escape sequence '\x1ff' in an unevaluated string literal}}
+ "0\x123"// expected-error {{invalid escape sequence '\x123' in an unevaluated string literal}}
+ "fx\xf" // expected-error {{invalid escape sequence '\xf' in an unevaluated string literal}}
+ "goop");
+
+static_assert(false, "\'\"\?\\\a\b\f\n\r\t\v"); // expected-error {{'"?\}}
+static_assert(true, "\xFF"); // expected-error {{invalid escape sequence '\xFF' in an unevaluated string literal}}
+static_assert(true, "\123"); // expected-error {{invalid escape sequence '\123' in an unevaluated string literal}}
+static_assert(true, "\pOh no, a Pascal string!"); // expected-warning {{unknown escape sequence '\p'}} \
+  // expected-error {{invalid escape sequence '\p' in an unevaluated string literal}}
 static_assert(false, R"(a
 \tb
 c
Index: clang/test/FixIt/fixit-static-assert.cpp
===
--- clang/test/FixIt/fixit-static-assert.cpp
+++ clang/test/FixIt/fixit-static-assert.cpp
@@ -11,8 +11,6 @@
 // String literal prefixes are good.
 static_assert(true && R"(RawString)");
 // CHECK-DAG: {[[@LINE-1]]:20-[[@LINE-1]]:22}:","
-static_assert(true && L"RawString");
-// CHECK-DAG: {[[@LINE-1]]:20-[[@LINE-1]]:22}:","
 
 static_assert(true);
 // CHECK-DAG: {[[@LINE-1]]:19-[[@LINE-1]]:19}:", \"\""
Index: clang/test/CXX/dcl.dcl/p4-0x.cpp
===
--- clang/test/CXX/dcl.dcl/p4-0x.cpp
+++

[clang] 2b7ac62 - [AArch64][RCPC3] Add Neon intrinsics for LDAP1 and STL1

2023-07-07 Thread Lucas Prates via cfe-commits

Author: Lucas Prates
Date: 2023-07-07T12:31:55+01:00
New Revision: 2b7ac6260627654def127598e0099938869f765a

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

LOG: [AArch64][RCPC3] Add Neon intrinsics for LDAP1 and STL1

This adds new intrisics to support the LDAP1 and STL1 Advanced SIMD
(Neon) instructions introduced as part of FEAT_LRCPC3.
The new intrinsics `vldap1(q)_lane`/`vstl1(q)_lane` generate IR code
similar to the existing `vld1(q)_lane/st1(q)_lane` ones, but capturing
the difference in the atomic release/acquire memory model.

The LLVM code generation changes to ensure that this instruction pair
is lowered to the correct LDAP1/STL1 instructions will be covered in a
separate commit.

Based on a patch by Sam Elliott.

Reviewed By: tmatheson

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

Added: 
clang/test/CodeGen/aarch64-neon-ldst-one-rcpc3.c

Modified: 
clang/include/clang/Basic/arm_neon.td
clang/lib/CodeGen/CGBuiltin.cpp
clang/utils/TableGen/NeonEmitter.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/arm_neon.td 
b/clang/include/clang/Basic/arm_neon.td
index 94dfe80acc3587..ba3764d2f778e8 100644
--- a/clang/include/clang/Basic/arm_neon.td
+++ b/clang/include/clang/Basic/arm_neon.td
@@ -2086,3 +2086,9 @@ let ArchGuard = "defined(__aarch64__)", TargetGuard = 
"bf16" in {
 "csilUcUsUiUlhfdPcPsPlQcQsQiQlQUcQUsQUiQUlQhQfQdQPcQPsQPlQPk", "bQb">;
   }
 }
+
+// v8.9a/v9.4a LRCPC3 intrinsics
+let ArchGuard = "defined(__aarch64__)", TargetGuard = "rcpc3" in {
+  def VLDAP1_LANE : WInst<"vldap1_lane", ".(c*!).I", "QUlQlUlldQdPlQPl">;
+  def VSTL1_LANE  : WInst<"vstl1_lane", "v*(.!)I", "QUlQlUlldQdPlQPl">;
+}

diff  --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 3d451bd7d140f2..8b503ef6b9c75e 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -6790,6 +6790,21 @@ static const std::pair 
NEONEquivalentIntrinsicMap[] = {
   { NEON::BI__builtin_neon_vuzpq_f16, NEON::BI__builtin_neon_vuzpq_v, },
   { NEON::BI__builtin_neon_vzip_f16, NEON::BI__builtin_neon_vzip_v, },
   { NEON::BI__builtin_neon_vzipq_f16, NEON::BI__builtin_neon_vzipq_v, },
+  // The mangling rules cause us to have one ID for each type for 
vldap1(q)_lane
+  // and vstl1(q)_lane, but codegen is equivalent for all of them. Choose an
+  // arbitrary one to be handled as tha canonical variation.
+  { NEON::BI__builtin_neon_vldap1_lane_u64, 
NEON::BI__builtin_neon_vldap1_lane_s64 },
+  { NEON::BI__builtin_neon_vldap1_lane_f64, 
NEON::BI__builtin_neon_vldap1_lane_s64 },
+  { NEON::BI__builtin_neon_vldap1_lane_p64, 
NEON::BI__builtin_neon_vldap1_lane_s64 },
+  { NEON::BI__builtin_neon_vldap1q_lane_u64, 
NEON::BI__builtin_neon_vldap1q_lane_s64 },
+  { NEON::BI__builtin_neon_vldap1q_lane_f64, 
NEON::BI__builtin_neon_vldap1q_lane_s64 },
+  { NEON::BI__builtin_neon_vldap1q_lane_p64, 
NEON::BI__builtin_neon_vldap1q_lane_s64 },
+  { NEON::BI__builtin_neon_vstl1_lane_u64, 
NEON::BI__builtin_neon_vstl1_lane_s64 },
+  { NEON::BI__builtin_neon_vstl1_lane_f64, 
NEON::BI__builtin_neon_vstl1_lane_s64 },
+  { NEON::BI__builtin_neon_vstl1_lane_p64, 
NEON::BI__builtin_neon_vstl1_lane_s64 },
+  { NEON::BI__builtin_neon_vstl1q_lane_u64, 
NEON::BI__builtin_neon_vstl1q_lane_s64 },
+  { NEON::BI__builtin_neon_vstl1q_lane_f64, 
NEON::BI__builtin_neon_vstl1q_lane_s64 },
+  { NEON::BI__builtin_neon_vstl1q_lane_p64, 
NEON::BI__builtin_neon_vstl1q_lane_s64 },
 };
 
 #undef NEONMAP0
@@ -10596,6 +10611,10 @@ Value 
*CodeGenFunction::EmitAArch64BuiltinExpr(unsigned BuiltinID,
   case NEON::BI__builtin_neon_vst1q_v:
   case NEON::BI__builtin_neon_vst1_lane_v:
   case NEON::BI__builtin_neon_vst1q_lane_v:
+  case NEON::BI__builtin_neon_vldap1_lane_s64:
+  case NEON::BI__builtin_neon_vldap1q_lane_s64:
+  case NEON::BI__builtin_neon_vstl1_lane_s64:
+  case NEON::BI__builtin_neon_vstl1q_lane_s64:
 // Get the alignment for the argument in addition to the value;
 // we'll use it later.
 PtrOp0 = EmitPointerWithAlignment(E->getArg(0));
@@ -12194,6 +12213,17 @@ Value 
*CodeGenFunction::EmitAArch64BuiltinExpr(unsigned BuiltinID,
PtrOp0.getAlignment());
 return Builder.CreateInsertElement(Ops[1], Ops[0], Ops[2], "vld1_lane");
   }
+  case NEON::BI__builtin_neon_vldap1_lane_s64:
+  case NEON::BI__builtin_neon_vldap1q_lane_s64: {
+Ops[1] = Builder.CreateBitCast(Ops[1], Ty);
+Ty = llvm::PointerType::getUnqual(VTy->getElementType());
+Ops[0] = Builder.CreateBitCast(Ops[0], Ty);
+llvm::LoadInst *LI = Builder.CreateAlignedLoad(
+VTy->getElementType(), Ops[0], PtrOp0.getAlignment());
+LI->setAtomic(llvm::AtomicOrdering::Acquire);
+Ops[0] = LI;

[PATCH] D154689: [clang] Correct calculation of MemberExpr's dependence

2023-07-07 Thread Mariya Podchishchaeva via Phabricator via cfe-commits
Fznamznon added a comment.

In D154689#4480249 , @cor3ntin wrote:

> I think this makes sense and it implements richard's suggestion. 
> However, it's missing a release note, can you add that before landing? 
> Thanks

Thank you for the review.
I think I added a release note here - 
https://reviews.llvm.org/D154689#change-RNUd6wICb9iD . Is something else needed?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154689

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


[PATCH] D153128: [AArch64][RCPC3] Add Neon intrinsics for LDAP1 and STL1

2023-07-07 Thread Lucas Prates 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 rG2b7ac6260627: [AArch64][RCPC3] Add Neon intrinsics for LDAP1 
and STL1 (authored by pratlucas).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153128

Files:
  clang/include/clang/Basic/arm_neon.td
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/test/CodeGen/aarch64-neon-ldst-one-rcpc3.c
  clang/utils/TableGen/NeonEmitter.cpp

Index: clang/utils/TableGen/NeonEmitter.cpp
===
--- clang/utils/TableGen/NeonEmitter.cpp
+++ clang/utils/TableGen/NeonEmitter.cpp
@@ -2086,12 +2086,13 @@
 
 std::string Name = Def->getName();
 // Omit type checking for the pointer arguments of vld1_lane, vld1_dup,
-// and vst1_lane intrinsics.  Using a pointer to the vector element
-// type with one of those operations causes codegen to select an aligned
-// load/store instruction.  If you want an unaligned operation,
-// the pointer argument needs to have less alignment than element type,
-// so just accept any pointer type.
-if (Name == "vld1_lane" || Name == "vld1_dup" || Name == "vst1_lane") {
+// vst1_lane, vldap1_lane, and vstl1_lane intrinsics.  Using a pointer to
+// the vector element type with one of those operations causes codegen to
+// select an aligned load/store instruction.  If you want an unaligned
+// operation, the pointer argument needs to have less alignment than element
+// type, so just accept any pointer type.
+if (Name == "vld1_lane" || Name == "vld1_dup" || Name == "vst1_lane" ||
+Name == "vldap1_lane" || Name == "vstl1_lane") {
   PtrArgNum = -1;
   HasConstPtr = false;
 }
Index: clang/test/CodeGen/aarch64-neon-ldst-one-rcpc3.c
===
--- /dev/null
+++ clang/test/CodeGen/aarch64-neon-ldst-one-rcpc3.c
@@ -0,0 +1,201 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
+// RUN: %clang_cc1 -triple aarch64-arm-none-eabi -target-feature +neon \
+// RUN:  -target-feature +rcpc3 -disable-O0-optnone -emit-llvm -o - %s \
+// RUN: | opt -S -passes=mem2reg | FileCheck %s
+
+// REQUIRES: aarch64-registered-target
+
+#include 
+
+
+// CHECK-LABEL: @test_vldap1q_lane_u64(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[TMP0:%.*]] = bitcast <2 x i64> [[B:%.*]] to <16 x i8>
+// CHECK-NEXT:[[TMP1:%.*]] = bitcast <16 x i8> [[TMP0]] to <2 x i64>
+// CHECK-NEXT:[[TMP2:%.*]] = load atomic i64, ptr [[A:%.*]] acquire, align 8
+// CHECK-NEXT:[[VLDAP1_LANE:%.*]] = insertelement <2 x i64> [[TMP1]], i64 [[TMP2]], i32 1
+// CHECK-NEXT:ret <2 x i64> [[VLDAP1_LANE]]
+//
+uint64x2_t test_vldap1q_lane_u64(uint64_t  *a, uint64x2_t b) {
+  return vldap1q_lane_u64(a, b, 1);
+}
+
+// CHECK-LABEL: @test_vldap1q_lane_s64(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[TMP0:%.*]] = bitcast <2 x i64> [[B:%.*]] to <16 x i8>
+// CHECK-NEXT:[[TMP1:%.*]] = bitcast <16 x i8> [[TMP0]] to <2 x i64>
+// CHECK-NEXT:[[TMP2:%.*]] = load atomic i64, ptr [[A:%.*]] acquire, align 8
+// CHECK-NEXT:[[VLDAP1_LANE:%.*]] = insertelement <2 x i64> [[TMP1]], i64 [[TMP2]], i32 1
+// CHECK-NEXT:ret <2 x i64> [[VLDAP1_LANE]]
+//
+int64x2_t test_vldap1q_lane_s64(int64_t  *a, int64x2_t b) {
+  return vldap1q_lane_s64(a, b, 1);
+}
+
+// CHECK-LABEL: @test_vldap1q_lane_f64(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[TMP0:%.*]] = bitcast <2 x double> [[B:%.*]] to <16 x i8>
+// CHECK-NEXT:[[TMP1:%.*]] = bitcast <16 x i8> [[TMP0]] to <2 x double>
+// CHECK-NEXT:[[TMP2:%.*]] = load atomic double, ptr [[A:%.*]] acquire, align 8
+// CHECK-NEXT:[[VLDAP1_LANE:%.*]] = insertelement <2 x double> [[TMP1]], double [[TMP2]], i32 1
+// CHECK-NEXT:ret <2 x double> [[VLDAP1_LANE]]
+//
+float64x2_t test_vldap1q_lane_f64(float64_t  *a, float64x2_t b) {
+  return vldap1q_lane_f64(a, b, 1);
+}
+
+// CHECK-LABEL: @test_vldap1q_lane_p64(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[TMP0:%.*]] = bitcast <2 x i64> [[B:%.*]] to <16 x i8>
+// CHECK-NEXT:[[TMP1:%.*]] = bitcast <16 x i8> [[TMP0]] to <2 x i64>
+// CHECK-NEXT:[[TMP2:%.*]] = load atomic i64, ptr [[A:%.*]] acquire, align 8
+// CHECK-NEXT:[[VLDAP1_LANE:%.*]] = insertelement <2 x i64> [[TMP1]], i64 [[TMP2]], i32 1
+// CHECK-NEXT:ret <2 x i64> [[VLDAP1_LANE]]
+//
+poly64x2_t test_vldap1q_lane_p64(poly64_t  *a, poly64x2_t b) {
+  return vldap1q_lane_p64(a, b, 1);
+}
+
+// CHECK-LABEL: @test_vldap1_lane_u64(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[TMP0:%.*]] = bitcast <1 x i64> [[B:%.*]] to <8 x i8>
+// CHECK-NEXT:[[TMP1:%.*]] = bitcast <8 x i8> [[TMP0]] to <1 x i64>
+// CHECK-NEXT:[[TMP2:%.*]] = load atomic i64, ptr [[A:%.*]] acquire, align 8
+// CHECK-NEXT:[[VLDAP1_LANE:%.*]] = insertelement <1 x i64> [[TMP1]], i64

[clang] f1d7a55 - [Clang][AArch64] Implement ACLE feature macro for FEAT_LRCPC3

2023-07-07 Thread Lucas Prates via cfe-commits

Author: Lucas Prates
Date: 2023-07-07T12:33:34+01:00
New Revision: f1d7a55a4e0627302881957d225342d5b1531675

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

LOG: [Clang][AArch64] Implement ACLE feature macro for FEAT_LRCPC3

This implements the new value for the `__ARM_FEATURE_RCPC` feature
macro, which was introduced to the ACLE to indicate the availability of
FEAT_LRCPC3.

More details can be found on:
https://github.com/ARM-software/acle/blob/main/main/acle.md#rcpc

Reviewed By: tmatheson

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

Added: 


Modified: 
clang/lib/Basic/Targets/AArch64.cpp
clang/lib/Basic/Targets/AArch64.h
clang/test/Preprocessor/aarch64-target-features.c

Removed: 




diff  --git a/clang/lib/Basic/Targets/AArch64.cpp 
b/clang/lib/Basic/Targets/AArch64.cpp
index 6de1728b1e50cc..ed0246d6faee16 100644
--- a/clang/lib/Basic/Targets/AArch64.cpp
+++ b/clang/lib/Basic/Targets/AArch64.cpp
@@ -415,7 +415,9 @@ void AArch64TargetInfo::getTargetDefines(const LangOptions 
&Opts,
   if (HasCRC)
 Builder.defineMacro("__ARM_FEATURE_CRC32", "1");
 
-  if (HasRCPC)
+  if (HasRCPC3)
+Builder.defineMacro("__ARM_FEATURE_RCPC", "3");
+  else if (HasRCPC)
 Builder.defineMacro("__ARM_FEATURE_RCPC", "1");
 
   if (HasFMV)
@@ -671,6 +673,7 @@ bool AArch64TargetInfo::hasFeature(StringRef Feature) const 
{
   .Case("bti", HasBTI)
   .Cases("ls64", "ls64_v", "ls64_accdata", HasLS64)
   .Case("wfxt", HasWFxT)
+  .Case("rcpc3", HasRCPC3)
   .Default(false);
 }
 
@@ -928,6 +931,8 @@ bool 
AArch64TargetInfo::handleTargetFeatures(std::vector &Features,
   HasD128 = true;
 if (Feature == "+gcs")
   HasGCS = true;
+if (Feature == "+rcpc3")
+  HasRCPC3 = true;
   }
 
   // Check features that are manually disabled by command line options.

diff  --git a/clang/lib/Basic/Targets/AArch64.h 
b/clang/lib/Basic/Targets/AArch64.h
index cce80e10f2bb1e..4304693e473dee 100644
--- a/clang/lib/Basic/Targets/AArch64.h
+++ b/clang/lib/Basic/Targets/AArch64.h
@@ -82,6 +82,7 @@ class LLVM_LIBRARY_VISIBILITY AArch64TargetInfo : public 
TargetInfo {
   bool HasNoSVE = false;
   bool HasFMV = true;
   bool HasGCS = false;
+  bool HasRCPC3 = false;
 
   const llvm::AArch64::ArchInfo *ArchInfo = &llvm::AArch64::ARMV8A;
 

diff  --git a/clang/test/Preprocessor/aarch64-target-features.c 
b/clang/test/Preprocessor/aarch64-target-features.c
index baf3fda73d591e..7f2b353ab18c0d 100644
--- a/clang/test/Preprocessor/aarch64-target-features.c
+++ b/clang/test/Preprocessor/aarch64-target-features.c
@@ -27,6 +27,7 @@
 // CHECK: __ARM_FEATURE_LDREX 0xF
 // CHECK: __ARM_FEATURE_NUMERIC_MAXMIN 1
 // CHECK-NOT: __ARM_FEATURE_RCPC 1
+// CHECK-NOT: __ARM_FEATURE_RCPC 3
 // CHECK-NOT: __ARM_FEATURE_SHA2 1
 // CHECK-NOT: __ARM_FEATURE_SHA3 1
 // CHECK-NOT: __ARM_FEATURE_SHA512 1
@@ -612,3 +613,6 @@
 
 // RUN: %clang --target=aarch64 -march=armv8.2-a+rcpc -x c -E -dM %s -o - | 
FileCheck --check-prefix=CHECK-RCPC %s
 // CHECK-RCPC: __ARM_FEATURE_RCPC 1
+
+// RUN: %clang --target=aarch64 -march=armv8.2-a+rcpc3 -x c -E -dM %s -o - | 
FileCheck --check-prefix=CHECK-RCPC3 %s
+// CHECK-RCPC3: __ARM_FEATURE_RCPC 3



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


[PATCH] D153130: [Clang][AArch64] Implement ACLE feature macro for FEAT_LRCPC3

2023-07-07 Thread Lucas Prates 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 rGf1d7a55a4e06: [Clang][AArch64] Implement ACLE feature macro 
for FEAT_LRCPC3 (authored by pratlucas).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153130

Files:
  clang/lib/Basic/Targets/AArch64.cpp
  clang/lib/Basic/Targets/AArch64.h
  clang/test/Preprocessor/aarch64-target-features.c


Index: clang/test/Preprocessor/aarch64-target-features.c
===
--- clang/test/Preprocessor/aarch64-target-features.c
+++ clang/test/Preprocessor/aarch64-target-features.c
@@ -27,6 +27,7 @@
 // CHECK: __ARM_FEATURE_LDREX 0xF
 // CHECK: __ARM_FEATURE_NUMERIC_MAXMIN 1
 // CHECK-NOT: __ARM_FEATURE_RCPC 1
+// CHECK-NOT: __ARM_FEATURE_RCPC 3
 // CHECK-NOT: __ARM_FEATURE_SHA2 1
 // CHECK-NOT: __ARM_FEATURE_SHA3 1
 // CHECK-NOT: __ARM_FEATURE_SHA512 1
@@ -612,3 +613,6 @@
 
 // RUN: %clang --target=aarch64 -march=armv8.2-a+rcpc -x c -E -dM %s -o - | 
FileCheck --check-prefix=CHECK-RCPC %s
 // CHECK-RCPC: __ARM_FEATURE_RCPC 1
+
+// RUN: %clang --target=aarch64 -march=armv8.2-a+rcpc3 -x c -E -dM %s -o - | 
FileCheck --check-prefix=CHECK-RCPC3 %s
+// CHECK-RCPC3: __ARM_FEATURE_RCPC 3
Index: clang/lib/Basic/Targets/AArch64.h
===
--- clang/lib/Basic/Targets/AArch64.h
+++ clang/lib/Basic/Targets/AArch64.h
@@ -82,6 +82,7 @@
   bool HasNoSVE = false;
   bool HasFMV = true;
   bool HasGCS = false;
+  bool HasRCPC3 = false;
 
   const llvm::AArch64::ArchInfo *ArchInfo = &llvm::AArch64::ARMV8A;
 
Index: clang/lib/Basic/Targets/AArch64.cpp
===
--- clang/lib/Basic/Targets/AArch64.cpp
+++ clang/lib/Basic/Targets/AArch64.cpp
@@ -415,7 +415,9 @@
   if (HasCRC)
 Builder.defineMacro("__ARM_FEATURE_CRC32", "1");
 
-  if (HasRCPC)
+  if (HasRCPC3)
+Builder.defineMacro("__ARM_FEATURE_RCPC", "3");
+  else if (HasRCPC)
 Builder.defineMacro("__ARM_FEATURE_RCPC", "1");
 
   if (HasFMV)
@@ -671,6 +673,7 @@
   .Case("bti", HasBTI)
   .Cases("ls64", "ls64_v", "ls64_accdata", HasLS64)
   .Case("wfxt", HasWFxT)
+  .Case("rcpc3", HasRCPC3)
   .Default(false);
 }
 
@@ -928,6 +931,8 @@
   HasD128 = true;
 if (Feature == "+gcs")
   HasGCS = true;
+if (Feature == "+rcpc3")
+  HasRCPC3 = true;
   }
 
   // Check features that are manually disabled by command line options.


Index: clang/test/Preprocessor/aarch64-target-features.c
===
--- clang/test/Preprocessor/aarch64-target-features.c
+++ clang/test/Preprocessor/aarch64-target-features.c
@@ -27,6 +27,7 @@
 // CHECK: __ARM_FEATURE_LDREX 0xF
 // CHECK: __ARM_FEATURE_NUMERIC_MAXMIN 1
 // CHECK-NOT: __ARM_FEATURE_RCPC 1
+// CHECK-NOT: __ARM_FEATURE_RCPC 3
 // CHECK-NOT: __ARM_FEATURE_SHA2 1
 // CHECK-NOT: __ARM_FEATURE_SHA3 1
 // CHECK-NOT: __ARM_FEATURE_SHA512 1
@@ -612,3 +613,6 @@
 
 // RUN: %clang --target=aarch64 -march=armv8.2-a+rcpc -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-RCPC %s
 // CHECK-RCPC: __ARM_FEATURE_RCPC 1
+
+// RUN: %clang --target=aarch64 -march=armv8.2-a+rcpc3 -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-RCPC3 %s
+// CHECK-RCPC3: __ARM_FEATURE_RCPC 3
Index: clang/lib/Basic/Targets/AArch64.h
===
--- clang/lib/Basic/Targets/AArch64.h
+++ clang/lib/Basic/Targets/AArch64.h
@@ -82,6 +82,7 @@
   bool HasNoSVE = false;
   bool HasFMV = true;
   bool HasGCS = false;
+  bool HasRCPC3 = false;
 
   const llvm::AArch64::ArchInfo *ArchInfo = &llvm::AArch64::ARMV8A;
 
Index: clang/lib/Basic/Targets/AArch64.cpp
===
--- clang/lib/Basic/Targets/AArch64.cpp
+++ clang/lib/Basic/Targets/AArch64.cpp
@@ -415,7 +415,9 @@
   if (HasCRC)
 Builder.defineMacro("__ARM_FEATURE_CRC32", "1");
 
-  if (HasRCPC)
+  if (HasRCPC3)
+Builder.defineMacro("__ARM_FEATURE_RCPC", "3");
+  else if (HasRCPC)
 Builder.defineMacro("__ARM_FEATURE_RCPC", "1");
 
   if (HasFMV)
@@ -671,6 +673,7 @@
   .Case("bti", HasBTI)
   .Cases("ls64", "ls64_v", "ls64_accdata", HasLS64)
   .Case("wfxt", HasWFxT)
+  .Case("rcpc3", HasRCPC3)
   .Default(false);
 }
 
@@ -928,6 +931,8 @@
   HasD128 = true;
 if (Feature == "+gcs")
   HasGCS = true;
+if (Feature == "+rcpc3")
+  HasRCPC3 = true;
   }
 
   // Check features that are manually disabled by command line options.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D153954: [WIP][clang][analyzer] Relax alpha.cplusplus.EnumCastOutOfRange checker

2023-07-07 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment.

In D153954#4480103 , @donat.nagy 
wrote:

> I think the old "report when the value stored in an enum type is not equal to 
> one of the enumerators" behavior would be useful as an opt-in checker that 
> could be adopted by some projects; while the new "relaxed" version is too 
> bland to be really useful. I'd suggest keeping the old behavior in the 
> general case, eliminating the "obvious" false positives like `std::byte` 
> (don't report types that have no enumerators) and moving this checker towards 
> the optin group.

I would agree that after ignoring the obvious cases (like no enumerators), a 
checker like this could be useful as an "optin" checker, however, I'd not 
recommend moving the actual implementation anywhere.
You can create "virtual" checkers like it's done in many cases, eg. 
`MismatchedDeallocatorChecker`.

FYI I haven't checked the actual implementation thoroughly, because I had 
higher-level remarks inline.




Comment at: clang/lib/StaticAnalyzer/Checkers/EnumCastOutOfRangeChecker.cpp:42
+class RangeBasedValueMatchEvaluator : ValueMatchEvaluator {
+  llvm::APSInt Min, Max;
 

I can see `llvm::APSInt` used a few places. Consider `using namespace llvm;`



Comment at: 
clang/lib/StaticAnalyzer/Checkers/EnumCastOutOfRangeChecker.cpp:65-69
+  if (TrueState && !FalseState) {
+Pred = C.addTransition(TrueState, Pred);
+  } else if (FalseState && !TrueState) {
+Pred = C.addTransition(FalseState, Pred);
+  }

Why do you fold the "Pred" ExplodedNode?
I'd say, you probably didn't want to use `addTransition` here.
Why don't you assume the subsequent assumptions and transition only once?

Anyway, I think it's better to have the `addTransition` closer to the outer 
scope (where the error reporting is done), so that we can easily see how many 
ways we branch off, etc.



Comment at: clang/test/Analysis/enum-cast-out-of-range.cpp:44
+// Suppress unused warnings
+[](...){}(unscoped, scoped);
+  }

`void sink(...);` would have achieved the same and I'd say it's less complex.
`sink(unscoped, scoped);`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153954

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


[PATCH] D154495: clang: Attach !fpmath metadata to __builtin_sqrt based on language flags

2023-07-07 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm added a comment.

In D154495#4479481 , @jdoerfert wrote:

> FWIW, I assume we want this also for OpenMP offload.

I'd be surprised if OpenMP let you do this by default


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

https://reviews.llvm.org/D154495

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


[clang] d68aae3 - [analyzer][NFC] Simplify CStringChecker strong types

2023-07-07 Thread Balazs Benics via cfe-commits

Author: Balazs Benics
Date: 2023-07-07T13:48:18+02:00
New Revision: d68aae3ff5d484e0792fdd86d444739edff0b56d

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

LOG: [analyzer][NFC] Simplify CStringChecker strong types

Added: 


Modified: 
clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp

Removed: 




diff  --git a/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
index e27b006903af3e..1bf6592ee6d8e0 100644
--- a/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
@@ -36,24 +36,12 @@ using namespace std::placeholders;
 
 namespace {
 struct AnyArgExpr {
-  // FIXME: Remove constructor in C++17 to turn it into an aggregate.
-  AnyArgExpr(const Expr *Expression, unsigned ArgumentIndex)
-  : Expression{Expression}, ArgumentIndex{ArgumentIndex} {}
   const Expr *Expression;
   unsigned ArgumentIndex;
 };
-
-struct SourceArgExpr : AnyArgExpr {
-  using AnyArgExpr::AnyArgExpr; // FIXME: Remove using in C++17.
-};
-
-struct DestinationArgExpr : AnyArgExpr {
-  using AnyArgExpr::AnyArgExpr; // FIXME: Same.
-};
-
-struct SizeArgExpr : AnyArgExpr {
-  using AnyArgExpr::AnyArgExpr; // FIXME: Same.
-};
+struct SourceArgExpr : AnyArgExpr {};
+struct DestinationArgExpr : AnyArgExpr {};
+struct SizeArgExpr : AnyArgExpr {};
 
 using ErrorMessage = SmallString<128>;
 enum class AccessKind { write, read };
@@ -1425,7 +1413,7 @@ void CStringChecker::evalMemmove(CheckerContext &C, const 
CallExpr *CE,
 
 void CStringChecker::evalBcopy(CheckerContext &C, const CallExpr *CE) const {
   // void bcopy(const void *src, void *dst, size_t n);
-  SourceArgExpr Src(CE->getArg(0), 0);
+  SourceArgExpr Src{CE->getArg(0), 0};
   DestinationArgExpr Dest = {CE->getArg(1), 1};
   SizeArgExpr Size = {CE->getArg(2), 2};
 



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


[PATCH] D154689: [clang] Correct calculation of MemberExpr's dependence

2023-07-07 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin added a comment.

In D154689#4480282 , @Fznamznon wrote:

> In D154689#4480249 , @cor3ntin 
> wrote:
>
>> I think this makes sense and it implements richard's suggestion. 
>> However, it's missing a release note, can you add that before landing? 
>> Thanks
>
> Thank you for the review.
> I think I added a release note here - 
> https://reviews.llvm.org/D154689#change-RNUd6wICb9iD . Is something else 
> needed?

Gosh, it's really not my day... nah, you're good! Sorry


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154689

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


[PATCH] D154602: [clang][clangd] Don't crash/assert on -gsplit-dwarf=single without output

2023-07-07 Thread Dmitry Polukhin via Phabricator via cfe-commits
DmitryPolukhin added inline comments.



Comment at: clang/lib/Driver/ToolChains/CommonArgs.cpp:1274
   if (Arg *A = Args.getLastArg(options::OPT_gsplit_dwarf_EQ))
-if (StringRef(A->getValue()) == "single")
+if (StringRef(A->getValue()) == "single" && Output.isFilename())
   return Args.MakeArgString(Output.getFilename());

yaxunl wrote:
> I am wondering in what situation the Output here is not a file name. Is it 
> possible to have a lit test for this?
It is possible to create lit test but still will be clangd lit test. I was not 
able to find case when it happens with clang driver itself. Nothing `Output` 
appears from 
https://github.com/llvm/llvm-project/blob/main/clang/lib/Driver/Driver.cpp#L5580
 in case of clangd. In case of clang driver next else is taken and it produces 
file based Output. As far as I understand clangd prefers unittests over lit 
tests. But I can convert it to lit test if you think it is better.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154602

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


[clang] 36f6743 - [AST] Stop evaluate constant expression if the condition expression which in switch statement contains errors

2023-07-07 Thread via cfe-commits

Author: yronglin
Date: 2023-07-07T19:56:47+08:00
New Revision: 36f67434f724f2cdf36735b243fdaace726afb85

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

LOG: [AST] Stop evaluate constant expression if the condition expression which 
in switch statement contains errors

This fix issue: https://github.com/llvm/llvm-project/issues/63453

```
constexpr int foo(unsigned char c) {
switch (f) {
case 0:
return 7;
default:
break;
}
return 0;
}

static_assert(foo('d'));

```

Reviewed By: aaron.ballman, erichkeane, hokein

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

Added: 


Modified: 
clang/docs/ReleaseNotes.rst
clang/lib/AST/ExprConstant.cpp
clang/test/SemaCXX/constexpr-function-recovery-crash.cpp

Removed: 




diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 8672b483cf836b..35caf85725c140 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -570,6 +570,9 @@ Bug Fixes in This Version
 - Clang now correctly evaluates ``__has_extension (cxx_defaulted_functions)``
   and ``__has_extension (cxx_default_function_template_args)`` to 1.
   (`#61758 `_)
+- Stop evaluating a constant expression if the condition expression which in
+  switch statement contains errors.
+  (`#63453 _`)
 
 Bug Fixes to Compiler Builtins
 ^^

diff  --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 39e6b634eb2520..c740aecf32f154 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -5007,12 +5007,13 @@ static EvalStmtResult EvaluateSwitch(StmtResult 
&Result, EvalInfo &Info,
 !EvaluateDecl(Info, SS->getConditionVariable()))
   return ESR_Failed;
 if (SS->getCond()->isValueDependent()) {
-  if (!EvaluateDependentExpr(SS->getCond(), Info))
-return ESR_Failed;
-} else {
-  if (!EvaluateInteger(SS->getCond(), Value, Info))
-return ESR_Failed;
+  // We don't know what the value is, and which branch should jump to.
+  EvaluateDependentExpr(SS->getCond(), Info);
+  return ESR_Failed;
 }
+if (!EvaluateInteger(SS->getCond(), Value, Info))
+  return ESR_Failed;
+
 if (!CondScope.destroy())
   return ESR_Failed;
   }

diff  --git a/clang/test/SemaCXX/constexpr-function-recovery-crash.cpp 
b/clang/test/SemaCXX/constexpr-function-recovery-crash.cpp
index 07bc5e57ae13ce..8bada7c0b6df3e 100644
--- a/clang/test/SemaCXX/constexpr-function-recovery-crash.cpp
+++ b/clang/test/SemaCXX/constexpr-function-recovery-crash.cpp
@@ -87,6 +87,7 @@ constexpr int force12 = test12();  // expected-error 
{{must be initializ
 // We're not checking specific recovery here so don't assert diagnostics.
 TEST_EVALUATE(Switch, switch (!!){});  // expected-error + {{}}
 TEST_EVALUATE(SwitchInit, switch (auto x = !!){}); // expected-error + {{}}
+TEST_EVALUATE(SwitchCondValDep, switch (invalid_value) { default: break; });   
 // expected-error + {{}}
 TEST_EVALUATE(For, for (!!){}); // expected-error + {{}}
 // FIXME: should bail out instead of looping.
 // expected-note@-2 + {{infinite loop}}



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


[PATCH] D153296: [AST] Stop evaluate constant expression if the condition expression which in switch statement contains errors

2023-07-07 Thread Yurong 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 rG36f67434f724: [AST] Stop evaluate constant expression if the 
condition expression which in… (authored by yronglin).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153296

Files:
  clang/docs/ReleaseNotes.rst
  clang/lib/AST/ExprConstant.cpp
  clang/test/SemaCXX/constexpr-function-recovery-crash.cpp


Index: clang/test/SemaCXX/constexpr-function-recovery-crash.cpp
===
--- clang/test/SemaCXX/constexpr-function-recovery-crash.cpp
+++ clang/test/SemaCXX/constexpr-function-recovery-crash.cpp
@@ -87,6 +87,7 @@
 // We're not checking specific recovery here so don't assert diagnostics.
 TEST_EVALUATE(Switch, switch (!!){});  // expected-error + {{}}
 TEST_EVALUATE(SwitchInit, switch (auto x = !!){}); // expected-error + {{}}
+TEST_EVALUATE(SwitchCondValDep, switch (invalid_value) { default: break; });   
 // expected-error + {{}}
 TEST_EVALUATE(For, for (!!){}); // expected-error + {{}}
 // FIXME: should bail out instead of looping.
 // expected-note@-2 + {{infinite loop}}
Index: clang/lib/AST/ExprConstant.cpp
===
--- clang/lib/AST/ExprConstant.cpp
+++ clang/lib/AST/ExprConstant.cpp
@@ -5007,12 +5007,13 @@
 !EvaluateDecl(Info, SS->getConditionVariable()))
   return ESR_Failed;
 if (SS->getCond()->isValueDependent()) {
-  if (!EvaluateDependentExpr(SS->getCond(), Info))
-return ESR_Failed;
-} else {
-  if (!EvaluateInteger(SS->getCond(), Value, Info))
-return ESR_Failed;
+  // We don't know what the value is, and which branch should jump to.
+  EvaluateDependentExpr(SS->getCond(), Info);
+  return ESR_Failed;
 }
+if (!EvaluateInteger(SS->getCond(), Value, Info))
+  return ESR_Failed;
+
 if (!CondScope.destroy())
   return ESR_Failed;
   }
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -570,6 +570,9 @@
 - Clang now correctly evaluates ``__has_extension (cxx_defaulted_functions)``
   and ``__has_extension (cxx_default_function_template_args)`` to 1.
   (`#61758 `_)
+- Stop evaluating a constant expression if the condition expression which in
+  switch statement contains errors.
+  (`#63453 _`)
 
 Bug Fixes to Compiler Builtins
 ^^


Index: clang/test/SemaCXX/constexpr-function-recovery-crash.cpp
===
--- clang/test/SemaCXX/constexpr-function-recovery-crash.cpp
+++ clang/test/SemaCXX/constexpr-function-recovery-crash.cpp
@@ -87,6 +87,7 @@
 // We're not checking specific recovery here so don't assert diagnostics.
 TEST_EVALUATE(Switch, switch (!!){});  // expected-error + {{}}
 TEST_EVALUATE(SwitchInit, switch (auto x = !!){}); // expected-error + {{}}
+TEST_EVALUATE(SwitchCondValDep, switch (invalid_value) { default: break; });// expected-error + {{}}
 TEST_EVALUATE(For, for (!!){}); // expected-error + {{}}
 // FIXME: should bail out instead of looping.
 // expected-note@-2 + {{infinite loop}}
Index: clang/lib/AST/ExprConstant.cpp
===
--- clang/lib/AST/ExprConstant.cpp
+++ clang/lib/AST/ExprConstant.cpp
@@ -5007,12 +5007,13 @@
 !EvaluateDecl(Info, SS->getConditionVariable()))
   return ESR_Failed;
 if (SS->getCond()->isValueDependent()) {
-  if (!EvaluateDependentExpr(SS->getCond(), Info))
-return ESR_Failed;
-} else {
-  if (!EvaluateInteger(SS->getCond(), Value, Info))
-return ESR_Failed;
+  // We don't know what the value is, and which branch should jump to.
+  EvaluateDependentExpr(SS->getCond(), Info);
+  return ESR_Failed;
 }
+if (!EvaluateInteger(SS->getCond(), Value, Info))
+  return ESR_Failed;
+
 if (!CondScope.destroy())
   return ESR_Failed;
   }
Index: clang/docs/ReleaseNotes.rst
===
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -570,6 +570,9 @@
 - Clang now correctly evaluates ``__has_extension (cxx_defaulted_functions)``
   and ``__has_extension (cxx_default_function_template_args)`` to 1.
   (`#61758 `_)
+- Stop evaluating a constant expression if the condition expression which in
+  switch statement contains errors.
+  (`#63453 

[PATCH] D153469: [dataflow] Replace most BoolValue subclasses with references to Formula (and AtomicBoolValue => Atom and BoolValue => Formula where appropriate)

2023-07-07 Thread Sam McCall via Phabricator via cfe-commits
sammccall added inline comments.



Comment at: clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h:532
+  void addToFlowCondition(const Formula &);
+  LLVM_DEPRECATED("Use Formula version instead", "")
   void addToFlowCondition(BoolValue &Val);

uabelho wrote:
> There are still uses of this method in-tree. I get the following error (and 
> many more) when I compile trunk now with -Werror:
> ```
> ../../clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp:148:9: 
> error: 'addToFlowCondition' is deprecated: Use Formula version instead 
> [-Werror,-Wdeprecated-declarations]
> Env.addToFlowCondition(*Val);
> ^
> ../../clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h:532:3: 
> note: 'addToFlowCondition' has been explicitly marked deprecated here
>   LLVM_DEPRECATED("Use Formula version instead", "")
>   ^
> ../include/llvm/Support/Compiler.h:155:50: note: expanded from macro 
> 'LLVM_DEPRECATED'
> #define LLVM_DEPRECATED(MSG, FIX) __attribute__((deprecated(MSG, FIX)))
>  ^
> 1 error generated.
> ```
Sure, I plan to clean these up once this change sticks.

Do you think -Wdeprecated -Werror is a build config we should keep working at 
all times?
This would mean you we can't use deprecation to migrate internal callers over 
multiple patches, essentially 

So building with -Wno-error=deprecated-declarations or so seems to make more 
sense to me, but I can't see anything written either way. (Nor buildbot mail)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153469

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


[PATCH] D153296: [AST] Stop evaluate constant expression if the condition expression which in switch statement contains errors

2023-07-07 Thread Yurong via Phabricator via cfe-commits
yronglin added a comment.

Thanks, landed! I have benefited a lot from your comments!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153296

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


[PATCH] D154706: [RISCV] Add XLEN width integer type: riscv_int.h

2023-07-07 Thread Kito Cheng via Phabricator via cfe-commits
kito-cheng created this revision.
kito-cheng added a reviewer: asb.
Herald added subscribers: jobnoorman, luke, VincentWu, vkmr, frasercrmck, 
luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, 
PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, 
shiva0217, niosHD, sabuasal, simoncook, johnrusso, rbar, arichardson.
Herald added a project: All.
kito-cheng requested review of this revision.
Herald added subscribers: cfe-commits, wangpc, eopXD.
Herald added a project: clang.

`riscv_int.h` contain `int_xlen_t`, `uint_xlen_t` and related marco.

See also: https://github.com/riscv-non-isa/riscv-c-api-doc/pull/14


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D154706

Files:
  clang/lib/Headers/CMakeLists.txt
  clang/lib/Headers/riscv_int.h


Index: clang/lib/Headers/riscv_int.h
===
--- /dev/null
+++ clang/lib/Headers/riscv_int.h
@@ -0,0 +1,61 @@
+/*===-- riscv_intrinsic.h - RISC-V  ===
+ *
+ * Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+ * See https://llvm.org/LICENSE.txt for license information.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ *
+ *===---===
+ */
+
+#ifndef __RISCV_INT_H
+
+#include 
+#include 
+
+#if __riscv_xlen == 32
+typedef int32_t __riscv_int_xlen_t;
+typedef uint32_t __riscv_uint_xlen_t;
+
+#define __RISCV_INT_XLEN_MIN INT32_MIN
+#define __RISCV_INT_XLEN_MAX INT32_MAX
+#define __RISCV_UINT_XLEN_MAX UINT32_MAX
+
+#define __RISCV_PRIdXLEN PRId32
+#define __RISCV_PRIiXLEN PRIi32
+#define __RISCV_PRIoXLEN PRIo32
+#define __RISCV_PRIuXLEN PRIu32
+#define __RISCV_PRIxXLEN PRIx32
+#define __RISCV_PRIXXLEN PRIX32
+
+#define __RISCV_SCNdXLEN SCNd32
+#define __RISCV_SCNiXLEN SCNi32
+#define __RISCV_SCNoXLEN SCNo32
+#define __RISCV_SCNuXLEN SCNu32
+#define __RISCV_SCNxXLEN SCNx32
+
+#elif __riscv_xlen == 64
+typedef int64_t __riscv_int_xlen_t;
+typedef uint64_t __riscv_uint_xlen_t;
+
+#define __RISCV_INT_XLEN_MIN INT64_MIN
+#define __RISCV_INT_XLEN_MAX INT64_MAX
+#define __RISCV_UINT_XLEN_MAX UINT64_MAX
+
+#define __RISCV_PRIdXLEN PRId64
+#define __RISCV_PRIiXLEN PRIi64
+#define __RISCV_PRIoXLEN PRIo64
+#define __RISCV_PRIuXLEN PRIu64
+#define __RISCV_PRIxXLEN PRIx64
+#define __RISCV_PRIXXLEN PRIX64
+
+#define __RISCV_SCNdXLEN SCNd64
+#define __RISCV_SCNiXLEN SCNi64
+#define __RISCV_SCNoXLEN SCNo64
+#define __RISCV_SCNuXLEN SCNu64
+#define __RISCV_SCNxXLEN SCNx64
+
+#else
+#error "Unknown XLEN"
+#endif
+
+#endif
Index: clang/lib/Headers/CMakeLists.txt
===
--- clang/lib/Headers/CMakeLists.txt
+++ clang/lib/Headers/CMakeLists.txt
@@ -99,6 +99,7 @@
   )
 
 set(riscv_files
+  riscv_int.h
   riscv_ntlh.h
   )
 


Index: clang/lib/Headers/riscv_int.h
===
--- /dev/null
+++ clang/lib/Headers/riscv_int.h
@@ -0,0 +1,61 @@
+/*===-- riscv_intrinsic.h - RISC-V  ===
+ *
+ * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+ * See https://llvm.org/LICENSE.txt for license information.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ *
+ *===---===
+ */
+
+#ifndef __RISCV_INT_H
+
+#include 
+#include 
+
+#if __riscv_xlen == 32
+typedef int32_t __riscv_int_xlen_t;
+typedef uint32_t __riscv_uint_xlen_t;
+
+#define __RISCV_INT_XLEN_MIN INT32_MIN
+#define __RISCV_INT_XLEN_MAX INT32_MAX
+#define __RISCV_UINT_XLEN_MAX UINT32_MAX
+
+#define __RISCV_PRIdXLEN PRId32
+#define __RISCV_PRIiXLEN PRIi32
+#define __RISCV_PRIoXLEN PRIo32
+#define __RISCV_PRIuXLEN PRIu32
+#define __RISCV_PRIxXLEN PRIx32
+#define __RISCV_PRIXXLEN PRIX32
+
+#define __RISCV_SCNdXLEN SCNd32
+#define __RISCV_SCNiXLEN SCNi32
+#define __RISCV_SCNoXLEN SCNo32
+#define __RISCV_SCNuXLEN SCNu32
+#define __RISCV_SCNxXLEN SCNx32
+
+#elif __riscv_xlen == 64
+typedef int64_t __riscv_int_xlen_t;
+typedef uint64_t __riscv_uint_xlen_t;
+
+#define __RISCV_INT_XLEN_MIN INT64_MIN
+#define __RISCV_INT_XLEN_MAX INT64_MAX
+#define __RISCV_UINT_XLEN_MAX UINT64_MAX
+
+#define __RISCV_PRIdXLEN PRId64
+#define __RISCV_PRIiXLEN PRIi64
+#define __RISCV_PRIoXLEN PRIo64
+#define __RISCV_PRIuXLEN PRIu64
+#define __RISCV_PRIxXLEN PRIx64
+#define __RISCV_PRIXXLEN PRIX64
+
+#define __RISCV_SCNdXLEN SCNd64
+#define __RISCV_SCNiXLEN SCNi64
+#define __RISCV_SCNoXLEN SCNo64
+#define __RISCV_SCNuXLEN SCNu64
+#define __RISCV_SCNxXLEN SCNx64
+
+#else
+#error "Unknown XLEN"
+#endif
+
+#endif
Index: clang/lib/Headers/CMakeLists.txt
===
--- clang/lib/Headers/CMakeLists.txt
+++ clang/lib/Headers/CMakeLists.txt
@@ -99,6 +99,7 @@
   )
 
 set(riscv_files
+  riscv_int.h
   riscv_ntlh.h
   )
 
___

[PATCH] D141700: AMDGPU: Move enqueued block handling into clang

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



Comment at: clang/lib/CodeGen/Targets/AMDGPU.cpp:520
+static llvm::StructType *getAMDGPUKernelDescriptorType(llvm::LLVMContext &C) {
+  llvm::Type *Int8 = llvm::IntegerType::getInt8Ty(C);
+  llvm::Type *Int16 = llvm::IntegerType::getInt16Ty(C);

Minor suggestion: you can get these types from CGF / CGM (Int8Ty etc.)



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

https://reviews.llvm.org/D141700

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


[PATCH] D154706: [RISCV] Add XLEN width integer type: riscv_int.h

2023-07-07 Thread Kito Cheng via Phabricator via cfe-commits
kito-cheng updated this revision to Diff 538094.
kito-cheng added a comment.

Chagnes:

- Update header comment.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154706

Files:
  clang/lib/Headers/CMakeLists.txt
  clang/lib/Headers/riscv_int.h


Index: clang/lib/Headers/riscv_int.h
===
--- /dev/null
+++ clang/lib/Headers/riscv_int.h
@@ -0,0 +1,61 @@
+/*===- riscv_int.h - RISC-V: XLEN-width integer type and format conversion 
--===
+ *
+ * Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+ * See https://llvm.org/LICENSE.txt for license information.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ *
+ *===---===
+ */
+
+#ifndef __RISCV_INT_H
+
+#include 
+#include 
+
+#if __riscv_xlen == 32
+typedef int32_t __riscv_int_xlen_t;
+typedef uint32_t __riscv_uint_xlen_t;
+
+#define __RISCV_INT_XLEN_MIN INT32_MIN
+#define __RISCV_INT_XLEN_MAX INT32_MAX
+#define __RISCV_UINT_XLEN_MAX UINT32_MAX
+
+#define __RISCV_PRIdXLEN PRId32
+#define __RISCV_PRIiXLEN PRIi32
+#define __RISCV_PRIoXLEN PRIo32
+#define __RISCV_PRIuXLEN PRIu32
+#define __RISCV_PRIxXLEN PRIx32
+#define __RISCV_PRIXXLEN PRIX32
+
+#define __RISCV_SCNdXLEN SCNd32
+#define __RISCV_SCNiXLEN SCNi32
+#define __RISCV_SCNoXLEN SCNo32
+#define __RISCV_SCNuXLEN SCNu32
+#define __RISCV_SCNxXLEN SCNx32
+
+#elif __riscv_xlen == 64
+typedef int64_t __riscv_int_xlen_t;
+typedef uint64_t __riscv_uint_xlen_t;
+
+#define __RISCV_INT_XLEN_MIN INT64_MIN
+#define __RISCV_INT_XLEN_MAX INT64_MAX
+#define __RISCV_UINT_XLEN_MAX UINT64_MAX
+
+#define __RISCV_PRIdXLEN PRId64
+#define __RISCV_PRIiXLEN PRIi64
+#define __RISCV_PRIoXLEN PRIo64
+#define __RISCV_PRIuXLEN PRIu64
+#define __RISCV_PRIxXLEN PRIx64
+#define __RISCV_PRIXXLEN PRIX64
+
+#define __RISCV_SCNdXLEN SCNd64
+#define __RISCV_SCNiXLEN SCNi64
+#define __RISCV_SCNoXLEN SCNo64
+#define __RISCV_SCNuXLEN SCNu64
+#define __RISCV_SCNxXLEN SCNx64
+
+#else
+#error "Unknown XLEN"
+#endif
+
+#endif
Index: clang/lib/Headers/CMakeLists.txt
===
--- clang/lib/Headers/CMakeLists.txt
+++ clang/lib/Headers/CMakeLists.txt
@@ -99,6 +99,7 @@
   )
 
 set(riscv_files
+  riscv_int.h
   riscv_ntlh.h
   )
 


Index: clang/lib/Headers/riscv_int.h
===
--- /dev/null
+++ clang/lib/Headers/riscv_int.h
@@ -0,0 +1,61 @@
+/*===- riscv_int.h - RISC-V: XLEN-width integer type and format conversion --===
+ *
+ * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+ * See https://llvm.org/LICENSE.txt for license information.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ *
+ *===---===
+ */
+
+#ifndef __RISCV_INT_H
+
+#include 
+#include 
+
+#if __riscv_xlen == 32
+typedef int32_t __riscv_int_xlen_t;
+typedef uint32_t __riscv_uint_xlen_t;
+
+#define __RISCV_INT_XLEN_MIN INT32_MIN
+#define __RISCV_INT_XLEN_MAX INT32_MAX
+#define __RISCV_UINT_XLEN_MAX UINT32_MAX
+
+#define __RISCV_PRIdXLEN PRId32
+#define __RISCV_PRIiXLEN PRIi32
+#define __RISCV_PRIoXLEN PRIo32
+#define __RISCV_PRIuXLEN PRIu32
+#define __RISCV_PRIxXLEN PRIx32
+#define __RISCV_PRIXXLEN PRIX32
+
+#define __RISCV_SCNdXLEN SCNd32
+#define __RISCV_SCNiXLEN SCNi32
+#define __RISCV_SCNoXLEN SCNo32
+#define __RISCV_SCNuXLEN SCNu32
+#define __RISCV_SCNxXLEN SCNx32
+
+#elif __riscv_xlen == 64
+typedef int64_t __riscv_int_xlen_t;
+typedef uint64_t __riscv_uint_xlen_t;
+
+#define __RISCV_INT_XLEN_MIN INT64_MIN
+#define __RISCV_INT_XLEN_MAX INT64_MAX
+#define __RISCV_UINT_XLEN_MAX UINT64_MAX
+
+#define __RISCV_PRIdXLEN PRId64
+#define __RISCV_PRIiXLEN PRIi64
+#define __RISCV_PRIoXLEN PRIo64
+#define __RISCV_PRIuXLEN PRIu64
+#define __RISCV_PRIxXLEN PRIx64
+#define __RISCV_PRIXXLEN PRIX64
+
+#define __RISCV_SCNdXLEN SCNd64
+#define __RISCV_SCNiXLEN SCNi64
+#define __RISCV_SCNoXLEN SCNo64
+#define __RISCV_SCNuXLEN SCNu64
+#define __RISCV_SCNxXLEN SCNx64
+
+#else
+#error "Unknown XLEN"
+#endif
+
+#endif
Index: clang/lib/Headers/CMakeLists.txt
===
--- clang/lib/Headers/CMakeLists.txt
+++ clang/lib/Headers/CMakeLists.txt
@@ -99,6 +99,7 @@
   )
 
 set(riscv_files
+  riscv_int.h
   riscv_ntlh.h
   )
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D153701: [Clang] Implement P2718R0 "Lifetime extension in range-based for loops"

2023-07-07 Thread Yurong via Phabricator via cfe-commits
yronglin marked an inline comment as done.
yronglin added inline comments.



Comment at: clang/lib/Sema/SemaExprCXX.cpp:8901-8914
+  // [P2718R0] Lifetime extension in range-based for loops.
+  //
+  // 6.7.7 [class.temporary] p5:
+  // There are four contexts in which temporaries are destroyed at a different
+  // point than the end of the full-expression.
+  //
+  // 6.7.7 [class.temporary] p6:

rsmith wrote:
> This isn't the right way to model the behavior here -- the presence or 
> absence of an `ExprWithCleanups` is just a convenience to tell consumers of 
> the AST whether they should expect to see cleanups later or not, and doesn't 
> carry an implication of affecting the actual temporary lifetimes and storage 
> durations.
> 
> The outcome that we should be aiming to reach is that all 
> `MaterializeTemporaryExpr`s created as part of processing the 
> for-range-initializer are marked as being lifetime-extended by the for-range 
> variable. Probably the simplest way to handle that would be to track the 
> current enclosing for-range-initializer variable in the 
> `ExpressionEvaluationContextRecord`, and whenever a 
> `MaterializeTemporaryExpr` is created, if there is a current enclosing 
> for-range-initializer, mark that `MaterializeTemporaryExpr` as being 
> lifetime-extended by it.
Awesome! Thanks a lot for your advice, this is very helpful! I want to take a 
longer look at it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153701

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


[PATCH] D153469: [dataflow] Replace most BoolValue subclasses with references to Formula (and AtomicBoolValue => Atom and BoolValue => Formula where appropriate)

2023-07-07 Thread Mikael Holmén via Phabricator via cfe-commits
uabelho added inline comments.



Comment at: clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h:532
+  void addToFlowCondition(const Formula &);
+  LLVM_DEPRECATED("Use Formula version instead", "")
   void addToFlowCondition(BoolValue &Val);

sammccall wrote:
> uabelho wrote:
> > There are still uses of this method in-tree. I get the following error (and 
> > many more) when I compile trunk now with -Werror:
> > ```
> > ../../clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp:148:9:
> >  error: 'addToFlowCondition' is deprecated: Use Formula version instead 
> > [-Werror,-Wdeprecated-declarations]
> > Env.addToFlowCondition(*Val);
> > ^
> > ../../clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h:532:3:
> >  note: 'addToFlowCondition' has been explicitly marked deprecated here
> >   LLVM_DEPRECATED("Use Formula version instead", "")
> >   ^
> > ../include/llvm/Support/Compiler.h:155:50: note: expanded from macro 
> > 'LLVM_DEPRECATED'
> > #define LLVM_DEPRECATED(MSG, FIX) __attribute__((deprecated(MSG, FIX)))
> >  ^
> > 1 error generated.
> > ```
> Sure, I plan to clean these up once this change sticks.
> 
> Do you think -Wdeprecated -Werror is a build config we should keep working at 
> all times?
> This would mean you we can't use deprecation to migrate internal callers over 
> multiple patches, essentially 
> 
> So building with -Wno-error=deprecated-declarations or so seems to make more 
> sense to me, but I can't see anything written either way. (Nor buildbot mail)
There are bots failing now at least:
 https://lab.llvm.org/buildbot/#/builders/57
 https://lab.llvm.org/buildbot/#/builders/214

I *think* deprecation is mainly used to let downstream adapt? And when 
deprecating stuff in-tree code is usually fixed at once?



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153469

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


[PATCH] D153954: [WIP][clang][analyzer] Relax alpha.cplusplus.EnumCastOutOfRange checker

2023-07-07 Thread Donát Nagy via Phabricator via cfe-commits
donat.nagy added a comment.

In D153954#4480296 , @steakhal wrote:

> [...] I'd not recommend moving the actual implementation anywhere.

I agree, I mostly spoke figuratively, suggesting that this checker could end up 
in the optin group when it's eventually brought out of alpha.




Comment at: clang/test/Analysis/enum-cast-out-of-range.cpp:44
+// Suppress unused warnings
+[](...){}(unscoped, scoped);
+  }

steakhal wrote:
> `void sink(...);` would have achieved the same and I'd say it's less complex.
> `sink(unscoped, scoped);`
Or just `(void)unscoped; (void)scoped;` if we're bikeshedding this test...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153954

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


[PATCH] D151087: [Clang] Permit address space casts with 'reinterpret_cast' in C++

2023-07-07 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm requested changes to this revision.
arsenm added a comment.
This revision now requires changes to proceed.

Conclusion seems to be this should have a separate cast operation


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151087

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


[PATCH] D154478: [analyzer][NFC] Use unique_ptrs for PathDiagnosticConsumers

2023-07-07 Thread Balázs Benics via Phabricator via cfe-commits
steakhal abandoned this revision.
steakhal added a comment.

Okay, I'm done. It's just a complete mess.
I'll come back to this once I have some time, but not now.

Here is what I found:
Unittests call `AnalysisConsumer->addDiagnosticConsumer()` after the 
`AnalysisConsumer` is constructed, but before 
`AnalysisConsumer::Initialize(ASTContext &Context)` is called - because the AST 
consumer is not yet invoked.
The `AnalysisConsumer::Initialize(ASTContext &Context)` supposed to construct 
the `CheckerManager` and `AnalysisManager` using the given `ASTContext`.

The `ASTContext` would be available even at the construction of 
`AnalysisConsumer` via the `CompilerInstance` - and that should work. So, I 
moved this lazy initialization to the ctor init list. - Works great, however, 
`CheckerManager` will do some checking for the checker dependencies, hence it 
needs all checkers to be configured at that point, which means that we should 
remove `AnalysisConsumer::AddCheckerRegistrationFn()` to make that happen. This 
implies that the construction of `AnalysisConsumer` would need to have all the 
checkers we need to configure upfront.
It's likely we can make it work, but would require some engineering on the 
unittests, which could this patch pump up even more.
And, I'd say, it's likely we can do something better overall if we just step 
back and redesign how things are getting constructed etc. And avoiding lazy 
initialization altogether.

I have a pretty good understanding of how things work now, so I might come back 
once I feel empowered.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154478

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


[PATCH] D154672: [OPENMP52] Deprecation of 'depend' clause in ordered directive.

2023-07-07 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added inline comments.



Comment at: clang/include/clang/Basic/DiagnosticParseKinds.td:1532
   InGroup;
+def warn_omp_depend_in_ordered_deprecated : Warning<"denpend clause for 
ordered is deprecated; use doacross instaed">, InGroup;
 

denpend->depend
instaed->instead


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154672

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


[PATCH] D154672: [OPENMP52] Deprecation of 'depend' clause in ordered directive.

2023-07-07 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: clang/include/clang/Basic/DiagnosticParseKinds.td:1532
   InGroup;
+def warn_omp_depend_in_ordered_deprecated : Warning<"denpend clause for 
ordered is deprecated; use doacross instaed">, InGroup;
 

ABataev wrote:
> denpend->depend
> instaed->instead
Also, wrap to 80 columns and put syntax elements in single quotes. e.g., 
'depend' clause for 'ordered'


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154672

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


[PATCH] D154133: [amdgpu] start documenting amdgpu support by clang

2023-07-07 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm accepted this revision.
arsenm added a comment.
This revision is now accepted and ready to land.

Need to start somewhere


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

https://reviews.llvm.org/D154133

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


[clang] 9d5cfed - [dataflow] Remove [[deprecated]] from deprecated functions

2023-07-07 Thread Sam McCall via cfe-commits

Author: Sam McCall
Date: 2023-07-07T14:35:29+02:00
New Revision: 9d5cfed2443aa294e67bea694d5aab02c40fa278

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

LOG: [dataflow] Remove [[deprecated]] from deprecated functions

This fixes -Werror -Wdeprecated builds
See D153469

Added: 


Modified: 
clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h

Removed: 




diff  --git a/clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h 
b/clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h
index 116373dce15c81..7c1d01ce816e2b 100644
--- a/clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h
+++ b/clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h
@@ -529,13 +529,13 @@ class Environment {
 
   /// Adds `Val` to the set of clauses that constitute the flow condition.
   void addToFlowCondition(const Formula &);
-  LLVM_DEPRECATED("Use Formula version instead", "")
+  /// Deprecated: Use Formula version instead.
   void addToFlowCondition(BoolValue &Val);
 
   /// Returns true if and only if the clauses that constitute the flow 
condition
   /// imply that `Val` is true.
   bool flowConditionImplies(const Formula &) const;
-  LLVM_DEPRECATED("Use Formula version instead", "")
+  /// Deprecated: Use Formula version instead.
   bool flowConditionImplies(BoolValue &Val) const;
 
   /// Returns the `DeclContext` of the block being analysed, if any. Otherwise,



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


[PATCH] D153469: [dataflow] Replace most BoolValue subclasses with references to Formula (and AtomicBoolValue => Atom and BoolValue => Formula where appropriate)

2023-07-07 Thread Sam McCall via Phabricator via cfe-commits
sammccall added inline comments.



Comment at: clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h:532
+  void addToFlowCondition(const Formula &);
+  LLVM_DEPRECATED("Use Formula version instead", "")
   void addToFlowCondition(BoolValue &Val);

uabelho wrote:
> sammccall wrote:
> > uabelho wrote:
> > > There are still uses of this method in-tree. I get the following error 
> > > (and many more) when I compile trunk now with -Werror:
> > > ```
> > > ../../clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp:148:9:
> > >  error: 'addToFlowCondition' is deprecated: Use Formula version instead 
> > > [-Werror,-Wdeprecated-declarations]
> > > Env.addToFlowCondition(*Val);
> > > ^
> > > ../../clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h:532:3:
> > >  note: 'addToFlowCondition' has been explicitly marked deprecated here
> > >   LLVM_DEPRECATED("Use Formula version instead", "")
> > >   ^
> > > ../include/llvm/Support/Compiler.h:155:50: note: expanded from macro 
> > > 'LLVM_DEPRECATED'
> > > #define LLVM_DEPRECATED(MSG, FIX) __attribute__((deprecated(MSG, FIX)))
> > >  ^
> > > 1 error generated.
> > > ```
> > Sure, I plan to clean these up once this change sticks.
> > 
> > Do you think -Wdeprecated -Werror is a build config we should keep working 
> > at all times?
> > This would mean you we can't use deprecation to migrate internal callers 
> > over multiple patches, essentially 
> > 
> > So building with -Wno-error=deprecated-declarations or so seems to make 
> > more sense to me, but I can't see anything written either way. (Nor 
> > buildbot mail)
> There are bots failing now at least:
>  https://lab.llvm.org/buildbot/#/builders/57
>  https://lab.llvm.org/buildbot/#/builders/214
> 
> I *think* deprecation is mainly used to let downstream adapt? And when 
> deprecating stuff in-tree code is usually fixed at once?
> 
Fair enough, thanks for the bot links

I don't think expanding the scope of the change for now is a good idea.
9d5cfed2443aa294e67bea694d5aab02c40fa278 replaces [[deprecated]] with a comment.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153469

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


[PATCH] D153725: [clang] Make amdgpu-arch tool work on Windows

2023-07-07 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm added inline comments.



Comment at: clang/tools/amdgpu-arch/AMDGPUArch.cpp:50
+#else
+  return printGPUsByHSA();
+#endif

The HIP path should work on linux too. I generally think we should build as 
much code as possible on all hosts, so how about
```
#ifndef _WIN32
  if (tryHSA())
return 0;
#endif

tryHIP()
```





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

https://reviews.llvm.org/D153725

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


[PATCH] D153725: [clang] Make amdgpu-arch tool work on Windows

2023-07-07 Thread Joseph Huber via Phabricator via cfe-commits
jhuber6 added inline comments.



Comment at: clang/tools/amdgpu-arch/AMDGPUArch.cpp:50
+#else
+  return printGPUsByHSA();
+#endif

arsenm wrote:
> The HIP path should work on linux too. I generally think we should build as 
> much code as possible on all hosts, so how about
> ```
> #ifndef _WIN32
>   if (tryHSA())
> return 0;
> #endif
> 
> tryHIP()
> ```
> 
> 
> 
That'd be fine, I'm in favor of sticking to HSA since it's a smaller runtime 
that's more reasonable to build standalone without the whole ROCm stack.


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

https://reviews.llvm.org/D153725

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


[PATCH] D154509: [clang][analyzer] StdLibraryFunctionsChecker: Allow NULL buffer in `fread` and `fwrite` if size is zero.

2023-07-07 Thread Donát Nagy via Phabricator via cfe-commits
donat.nagy added a comment.

By the way here is a concrete example where this patch is needed to squash a 
false positive: 
https://codechecker-demo.eastus.cloudapp.azure.com/Default/report-detail?run=postgres_REL_13_0_stdclf_notetag_interesting_test_3&is-unique=on&report-hash=49939ae1896dff1ad782092b8534bd68&report-filepath=%2arelcache.c&report-id=1942889


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154509

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


[PATCH] D153469: [dataflow] Replace most BoolValue subclasses with references to Formula (and AtomicBoolValue => Atom and BoolValue => Formula where appropriate)

2023-07-07 Thread Mikael Holmén via Phabricator via cfe-commits
uabelho added inline comments.



Comment at: clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h:532
+  void addToFlowCondition(const Formula &);
+  LLVM_DEPRECATED("Use Formula version instead", "")
   void addToFlowCondition(BoolValue &Val);

sammccall wrote:
> uabelho wrote:
> > sammccall wrote:
> > > uabelho wrote:
> > > > There are still uses of this method in-tree. I get the following error 
> > > > (and many more) when I compile trunk now with -Werror:
> > > > ```
> > > > ../../clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp:148:9:
> > > >  error: 'addToFlowCondition' is deprecated: Use Formula version instead 
> > > > [-Werror,-Wdeprecated-declarations]
> > > > Env.addToFlowCondition(*Val);
> > > > ^
> > > > ../../clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h:532:3:
> > > >  note: 'addToFlowCondition' has been explicitly marked deprecated here
> > > >   LLVM_DEPRECATED("Use Formula version instead", "")
> > > >   ^
> > > > ../include/llvm/Support/Compiler.h:155:50: note: expanded from macro 
> > > > 'LLVM_DEPRECATED'
> > > > #define LLVM_DEPRECATED(MSG, FIX) __attribute__((deprecated(MSG, FIX)))
> > > >  ^
> > > > 1 error generated.
> > > > ```
> > > Sure, I plan to clean these up once this change sticks.
> > > 
> > > Do you think -Wdeprecated -Werror is a build config we should keep 
> > > working at all times?
> > > This would mean you we can't use deprecation to migrate internal callers 
> > > over multiple patches, essentially 
> > > 
> > > So building with -Wno-error=deprecated-declarations or so seems to make 
> > > more sense to me, but I can't see anything written either way. (Nor 
> > > buildbot mail)
> > There are bots failing now at least:
> >  https://lab.llvm.org/buildbot/#/builders/57
> >  https://lab.llvm.org/buildbot/#/builders/214
> > 
> > I *think* deprecation is mainly used to let downstream adapt? And when 
> > deprecating stuff in-tree code is usually fixed at once?
> > 
> Fair enough, thanks for the bot links
> 
> I don't think expanding the scope of the change for now is a good idea.
> 9d5cfed2443aa294e67bea694d5aab02c40fa278 replaces [[deprecated]] with a 
> comment.
Thank you!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153469

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


[PATCH] D154709: [clang][ASTImporter] Add a 'Message' member to ASTImportError use it throught ASTImporter

2023-07-07 Thread Michael Buch via Phabricator via cfe-commits
Michael137 created this revision.
Michael137 added reviewers: martong, balazske.
Herald added a reviewer: a.sidorin.
Herald added a reviewer: shafik.
Herald added a project: All.
Michael137 requested review of this revision.
Herald added subscribers: cfe-commits, wangpc.
Herald added a project: clang.

This patch adds a new `ASTImportError::Message` which is used
to more accurately describe a failure when `ASTImportError::log`
is called. We then set this error message throughout ASTImporter.

The motivation for this is that in upcoming patches LLDB will
check `ASTImportError`s and log them on failures. At the moment
these logs wouldn't be helpful since we wouldn't be able to
differentiate between the different conflicts that occur
during a single import process.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D154709

Files:
  clang/include/clang/AST/ASTImportError.h
  clang/lib/AST/ASTImporter.cpp

Index: clang/lib/AST/ASTImporter.cpp
===
--- clang/lib/AST/ASTImporter.cpp
+++ clang/lib/AST/ASTImporter.cpp
@@ -14,6 +14,7 @@
 #include "clang/AST/ASTImporter.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/ASTDiagnostic.h"
+#include "clang/AST/ASTImportError.h"
 #include "clang/AST/ASTImporterSharedState.h"
 #include "clang/AST/ASTStructuralEquivalence.h"
 #include "clang/AST/Attr.h"
@@ -34,6 +35,7 @@
 #include "clang/AST/LambdaCapture.h"
 #include "clang/AST/NestedNameSpecifier.h"
 #include "clang/AST/OperationKinds.h"
+#include "clang/AST/PrettyPrinter.h"
 #include "clang/AST/Stmt.h"
 #include "clang/AST/StmtCXX.h"
 #include "clang/AST/StmtObjC.h"
@@ -61,7 +63,9 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/raw_ostream.h"
 #include 
 #include 
 #include 
@@ -84,7 +88,6 @@
   using ExpectedName = llvm::Expected;
 
   std::string ASTImportError::toString() const {
-// FIXME: Improve error texts.
 switch (Error) {
 case NameConflict:
   return "NameConflict";
@@ -97,7 +100,11 @@
 return "Invalid error code.";
   }
 
-  void ASTImportError::log(raw_ostream &OS) const { OS << toString(); }
+  void ASTImportError::log(raw_ostream &OS) const {
+OS << toString();
+if (!Message.empty())
+  OS << ": " << Message;
+  }
 
   std::error_code ASTImportError::convertToErrorCode() const {
 llvm_unreachable("Function not implemented.");
@@ -1066,7 +1073,8 @@
 ExpectedType ASTNodeImporter::VisitType(const Type *T) {
   Importer.FromDiag(SourceLocation(), diag::err_unsupported_ast_node)
 << T->getTypeClassName();
-  return make_error(ASTImportError::UnsupportedConstruct);
+  return make_error(ASTImportError::UnsupportedConstruct,
+T->getTypeClassName());
 }
 
 ExpectedType ASTNodeImporter::VisitAtomicType(const AtomicType *T){
@@ -1715,7 +1723,8 @@
   if (RT && RT->getDecl() == D) {
 Importer.FromDiag(D->getLocation(), diag::err_unsupported_ast_node)
 << D->getDeclKindName();
-return make_error(ASTImportError::UnsupportedConstruct);
+return make_error(ASTImportError::UnsupportedConstruct,
+  D->getDeclKindName());
   }
 }
   }
@@ -2238,13 +2247,15 @@
 ExpectedDecl ASTNodeImporter::VisitDecl(Decl *D) {
   Importer.FromDiag(D->getLocation(), diag::err_unsupported_ast_node)
 << D->getDeclKindName();
-  return make_error(ASTImportError::UnsupportedConstruct);
+  return make_error(ASTImportError::UnsupportedConstruct,
+D->getDeclKindName());
 }
 
 ExpectedDecl ASTNodeImporter::VisitImportDecl(ImportDecl *D) {
   Importer.FromDiag(D->getLocation(), diag::err_unsupported_ast_node)
   << D->getDeclKindName();
-  return make_error(ASTImportError::UnsupportedConstruct);
+  return make_error(ASTImportError::UnsupportedConstruct,
+D->getDeclKindName());
 }
 
 ExpectedDecl ASTNodeImporter::VisitEmptyDecl(EmptyDecl *D) {
@@ -3893,7 +3904,13 @@
   Importer.ToDiag(FoundField->getLocation(), diag::note_odr_value_here)
 << FoundField->getType();
 
-  return make_error(ASTImportError::NameConflict);
+  std::string ErrMessage;
+  llvm::raw_string_ostream OS(ErrMessage);
+  OS << "Field '" << Name.getAsString()
+ << "' declared with incompatible types in different TUs ('"
+ << D->getType() << "' and '" << FoundField->getType() << "')";
+  return make_error(ASTImportError::NameConflict,
+std::move(ErrMessage));
 }
   }
 
@@ -3972,7 +3989,13 @@
   Importer.ToDiag(FoundField->getLocation(), diag::note_odr_value_here)
 << FoundField->getType();
 
-  return make_error(ASTImportError::NameConflict);
+  std::string ErrMessage;
+  llvm::ra

[PATCH] D154709: [clang][ASTImporter] Add a 'Message' member to ASTImportError use it throught ASTImporter

2023-07-07 Thread Michael Buch via Phabricator via cfe-commits
Michael137 updated this revision to Diff 538110.
Michael137 added a comment.

- Remove redundant header additions


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154709

Files:
  clang/include/clang/AST/ASTImportError.h
  clang/lib/AST/ASTImporter.cpp

Index: clang/lib/AST/ASTImporter.cpp
===
--- clang/lib/AST/ASTImporter.cpp
+++ clang/lib/AST/ASTImporter.cpp
@@ -84,7 +84,6 @@
   using ExpectedName = llvm::Expected;
 
   std::string ASTImportError::toString() const {
-// FIXME: Improve error texts.
 switch (Error) {
 case NameConflict:
   return "NameConflict";
@@ -97,7 +96,11 @@
 return "Invalid error code.";
   }
 
-  void ASTImportError::log(raw_ostream &OS) const { OS << toString(); }
+  void ASTImportError::log(raw_ostream &OS) const {
+OS << toString();
+if (!Message.empty())
+  OS << ": " << Message;
+  }
 
   std::error_code ASTImportError::convertToErrorCode() const {
 llvm_unreachable("Function not implemented.");
@@ -1066,7 +1069,8 @@
 ExpectedType ASTNodeImporter::VisitType(const Type *T) {
   Importer.FromDiag(SourceLocation(), diag::err_unsupported_ast_node)
 << T->getTypeClassName();
-  return make_error(ASTImportError::UnsupportedConstruct);
+  return make_error(ASTImportError::UnsupportedConstruct,
+T->getTypeClassName());
 }
 
 ExpectedType ASTNodeImporter::VisitAtomicType(const AtomicType *T){
@@ -1715,7 +1719,8 @@
   if (RT && RT->getDecl() == D) {
 Importer.FromDiag(D->getLocation(), diag::err_unsupported_ast_node)
 << D->getDeclKindName();
-return make_error(ASTImportError::UnsupportedConstruct);
+return make_error(ASTImportError::UnsupportedConstruct,
+  D->getDeclKindName());
   }
 }
   }
@@ -2238,13 +2243,15 @@
 ExpectedDecl ASTNodeImporter::VisitDecl(Decl *D) {
   Importer.FromDiag(D->getLocation(), diag::err_unsupported_ast_node)
 << D->getDeclKindName();
-  return make_error(ASTImportError::UnsupportedConstruct);
+  return make_error(ASTImportError::UnsupportedConstruct,
+D->getDeclKindName());
 }
 
 ExpectedDecl ASTNodeImporter::VisitImportDecl(ImportDecl *D) {
   Importer.FromDiag(D->getLocation(), diag::err_unsupported_ast_node)
   << D->getDeclKindName();
-  return make_error(ASTImportError::UnsupportedConstruct);
+  return make_error(ASTImportError::UnsupportedConstruct,
+D->getDeclKindName());
 }
 
 ExpectedDecl ASTNodeImporter::VisitEmptyDecl(EmptyDecl *D) {
@@ -3893,7 +3900,13 @@
   Importer.ToDiag(FoundField->getLocation(), diag::note_odr_value_here)
 << FoundField->getType();
 
-  return make_error(ASTImportError::NameConflict);
+  std::string ErrMessage;
+  llvm::raw_string_ostream OS(ErrMessage);
+  OS << "Field '" << Name.getAsString()
+ << "' declared with incompatible types in different TUs ('"
+ << D->getType() << "' and '" << FoundField->getType() << "')";
+  return make_error(ASTImportError::NameConflict,
+std::move(ErrMessage));
 }
   }
 
@@ -3972,7 +3985,13 @@
   Importer.ToDiag(FoundField->getLocation(), diag::note_odr_value_here)
 << FoundField->getType();
 
-  return make_error(ASTImportError::NameConflict);
+  std::string ErrMessage;
+  llvm::raw_string_ostream OS(ErrMessage);
+  OS << "IndirectField '" << Name.getAsString()
+ << "' declared with incompatible types in different TUs ('"
+ << D->getType() << "' and '" << FoundField->getType() << "')";
+  return make_error(ASTImportError::NameConflict,
+std::move(ErrMessage));
 }
   }
 
@@ -4163,7 +4182,13 @@
   Importer.ToDiag(FoundIvar->getLocation(), diag::note_odr_value_here)
 << FoundIvar->getType();
 
-  return make_error(ASTImportError::NameConflict);
+  std::string ErrMessage;
+  llvm::raw_string_ostream OS(ErrMessage);
+  OS << "ObjCIvarDecl '" << Name.getAsString()
+ << "' declared with incompatible types in different TUs ('"
+ << D->getType() << "' and '" << FoundIvar->getType() << "')";
+  return make_error(ASTImportError::NameConflict,
+std::move(ErrMessage));
 }
   }
 
@@ -4471,7 +4496,14 @@
 diag::note_odr_objc_method_here)
   << D->isInstanceMethod() << Name;
 
-return make_error(ASTImportError::NameConflict);
+std::string ErrMessage;
+llvm::raw_string_ostream OS(ErrMessage);
+OS << "ObjCMethodDecl '" << Name.getAsString()
+   << "' has incompatible result types in different TUs ('"
+   << D->getReturnType() << "' and '" << FoundMethod->getReturnType()
+   

[PATCH] D154709: [clang][ASTImporter] Add a 'Message' member to ASTImportError use it throught ASTImporter

2023-07-07 Thread Michael Buch via Phabricator via cfe-commits
Michael137 added a comment.

Didn't add tests for this since checking the contents of the error message 
didn't seem worth testing.
But don't mind adding tests if reviewers feel more comfortable


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154709

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


[PATCH] D154709: [clang][ASTImporter] Add a 'Message' member to ASTImportError and use it throughout ASTImporter

2023-07-07 Thread Michael Buch via Phabricator via cfe-commits
Michael137 updated this revision to Diff 538111.
Michael137 added a comment.

- Fix commit message


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154709

Files:
  clang/include/clang/AST/ASTImportError.h
  clang/lib/AST/ASTImporter.cpp

Index: clang/lib/AST/ASTImporter.cpp
===
--- clang/lib/AST/ASTImporter.cpp
+++ clang/lib/AST/ASTImporter.cpp
@@ -84,7 +84,6 @@
   using ExpectedName = llvm::Expected;
 
   std::string ASTImportError::toString() const {
-// FIXME: Improve error texts.
 switch (Error) {
 case NameConflict:
   return "NameConflict";
@@ -97,7 +96,11 @@
 return "Invalid error code.";
   }
 
-  void ASTImportError::log(raw_ostream &OS) const { OS << toString(); }
+  void ASTImportError::log(raw_ostream &OS) const {
+OS << toString();
+if (!Message.empty())
+  OS << ": " << Message;
+  }
 
   std::error_code ASTImportError::convertToErrorCode() const {
 llvm_unreachable("Function not implemented.");
@@ -1066,7 +1069,8 @@
 ExpectedType ASTNodeImporter::VisitType(const Type *T) {
   Importer.FromDiag(SourceLocation(), diag::err_unsupported_ast_node)
 << T->getTypeClassName();
-  return make_error(ASTImportError::UnsupportedConstruct);
+  return make_error(ASTImportError::UnsupportedConstruct,
+T->getTypeClassName());
 }
 
 ExpectedType ASTNodeImporter::VisitAtomicType(const AtomicType *T){
@@ -1715,7 +1719,8 @@
   if (RT && RT->getDecl() == D) {
 Importer.FromDiag(D->getLocation(), diag::err_unsupported_ast_node)
 << D->getDeclKindName();
-return make_error(ASTImportError::UnsupportedConstruct);
+return make_error(ASTImportError::UnsupportedConstruct,
+  D->getDeclKindName());
   }
 }
   }
@@ -2238,13 +2243,15 @@
 ExpectedDecl ASTNodeImporter::VisitDecl(Decl *D) {
   Importer.FromDiag(D->getLocation(), diag::err_unsupported_ast_node)
 << D->getDeclKindName();
-  return make_error(ASTImportError::UnsupportedConstruct);
+  return make_error(ASTImportError::UnsupportedConstruct,
+D->getDeclKindName());
 }
 
 ExpectedDecl ASTNodeImporter::VisitImportDecl(ImportDecl *D) {
   Importer.FromDiag(D->getLocation(), diag::err_unsupported_ast_node)
   << D->getDeclKindName();
-  return make_error(ASTImportError::UnsupportedConstruct);
+  return make_error(ASTImportError::UnsupportedConstruct,
+D->getDeclKindName());
 }
 
 ExpectedDecl ASTNodeImporter::VisitEmptyDecl(EmptyDecl *D) {
@@ -3893,7 +3900,13 @@
   Importer.ToDiag(FoundField->getLocation(), diag::note_odr_value_here)
 << FoundField->getType();
 
-  return make_error(ASTImportError::NameConflict);
+  std::string ErrMessage;
+  llvm::raw_string_ostream OS(ErrMessage);
+  OS << "Field '" << Name.getAsString()
+ << "' declared with incompatible types in different TUs ('"
+ << D->getType() << "' and '" << FoundField->getType() << "')";
+  return make_error(ASTImportError::NameConflict,
+std::move(ErrMessage));
 }
   }
 
@@ -3972,7 +3985,13 @@
   Importer.ToDiag(FoundField->getLocation(), diag::note_odr_value_here)
 << FoundField->getType();
 
-  return make_error(ASTImportError::NameConflict);
+  std::string ErrMessage;
+  llvm::raw_string_ostream OS(ErrMessage);
+  OS << "IndirectField '" << Name.getAsString()
+ << "' declared with incompatible types in different TUs ('"
+ << D->getType() << "' and '" << FoundField->getType() << "')";
+  return make_error(ASTImportError::NameConflict,
+std::move(ErrMessage));
 }
   }
 
@@ -4163,7 +4182,13 @@
   Importer.ToDiag(FoundIvar->getLocation(), diag::note_odr_value_here)
 << FoundIvar->getType();
 
-  return make_error(ASTImportError::NameConflict);
+  std::string ErrMessage;
+  llvm::raw_string_ostream OS(ErrMessage);
+  OS << "ObjCIvarDecl '" << Name.getAsString()
+ << "' declared with incompatible types in different TUs ('"
+ << D->getType() << "' and '" << FoundIvar->getType() << "')";
+  return make_error(ASTImportError::NameConflict,
+std::move(ErrMessage));
 }
   }
 
@@ -4471,7 +4496,14 @@
 diag::note_odr_objc_method_here)
   << D->isInstanceMethod() << Name;
 
-return make_error(ASTImportError::NameConflict);
+std::string ErrMessage;
+llvm::raw_string_ostream OS(ErrMessage);
+OS << "ObjCMethodDecl '" << Name.getAsString()
+   << "' has incompatible result types in different TUs ('"
+   << D->getReturnType() << "' and '" << FoundMethod->getReturnType()
+   << "')"

[PATCH] D139629: clang: Stop emitting "strictfp"

2023-07-07 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm added a comment.

ping


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

https://reviews.llvm.org/D139629

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


[PATCH] D154423: [clang][analyzer] Add all success/failure messages to StdLibraryFunctionsChecker.

2023-07-07 Thread Donát Nagy via Phabricator via cfe-commits
donat.nagy added a comment.

I looked through most of the open source results, and they look promising.

However I've seen one questionable tendency: there are many reports (e.g. this 
one 
)
 where the checker assumes that `fileno(stdin)`, `fileno(stdout)` or 
`fileno(stderr)` fails. How realistic are these assumptions? Do we need to 
bother the programmer with these or should/can we silence them (and perhaps 
return the known fileno values corresponding to these standard streams)?

Another, concrete issue is this report 

 where the analyzer assumes that `ftell` returns `-1` (that gets converted to 
2**64-1 because unsigned numbers are crazy), but there is no note tag (not even 
in the _3 run) and I don't see where does this assumption come from (although I 
didn't do a deep analysis).

Apart from these, the false positives are coming from general limitations of 
the engine that cannot be reasonably avoided.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154423

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


[clang] 9a97e3b - HIP: Directly call ceil builtins

2023-07-07 Thread Matt Arsenault via cfe-commits

Author: Matt Arsenault
Date: 2023-07-07T09:26:07-04:00
New Revision: 9a97e3bf8c3f576b29dfcd76925b6c23b3961b99

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

LOG: HIP: Directly call ceil builtins

Added: 


Modified: 
clang/lib/Headers/__clang_hip_math.h
clang/test/Headers/__clang_hip_math.hip

Removed: 




diff  --git a/clang/lib/Headers/__clang_hip_math.h 
b/clang/lib/Headers/__clang_hip_math.h
index a914496cb7b14a..c67f20873253b0 100644
--- a/clang/lib/Headers/__clang_hip_math.h
+++ b/clang/lib/Headers/__clang_hip_math.h
@@ -182,7 +182,7 @@ __DEVICE__
 float cbrtf(float __x) { return __ocml_cbrt_f32(__x); }
 
 __DEVICE__
-float ceilf(float __x) { return __ocml_ceil_f32(__x); }
+float ceilf(float __x) { return __builtin_ceilf(__x); }
 
 __DEVICE__
 float copysignf(float __x, float __y) { return __builtin_copysignf(__x, __y); }
@@ -731,7 +731,7 @@ __DEVICE__
 double cbrt(double __x) { return __ocml_cbrt_f64(__x); }
 
 __DEVICE__
-double ceil(double __x) { return __ocml_ceil_f64(__x); }
+double ceil(double __x) { return __builtin_ceil(__x); }
 
 __DEVICE__
 double copysign(double __x, double __y) {

diff  --git a/clang/test/Headers/__clang_hip_math.hip 
b/clang/test/Headers/__clang_hip_math.hip
index 8e5201a89ceca2..a6797b01f25b27 100644
--- a/clang/test/Headers/__clang_hip_math.hip
+++ b/clang/test/Headers/__clang_hip_math.hip
@@ -475,13 +475,13 @@ extern "C" __device__ double test_cbrt(double x) {
 
 // DEFAULT-LABEL: @test_ceilf(
 // DEFAULT-NEXT:  entry:
-// DEFAULT-NEXT:[[CALL_I:%.*]] = tail call contract float 
@__ocml_ceil_f32(float noundef [[X:%.*]]) #[[ATTR14]]
-// DEFAULT-NEXT:ret float [[CALL_I]]
+// DEFAULT-NEXT:[[TMP0:%.*]] = tail call contract float 
@llvm.ceil.f32(float [[X:%.*]])
+// DEFAULT-NEXT:ret float [[TMP0]]
 //
 // FINITEONLY-LABEL: @test_ceilf(
 // FINITEONLY-NEXT:  entry:
-// FINITEONLY-NEXT:[[CALL_I:%.*]] = tail call nnan ninf contract 
nofpclass(nan inf) float @__ocml_ceil_f32(float noundef nofpclass(nan inf) 
[[X:%.*]]) #[[ATTR14]]
-// FINITEONLY-NEXT:ret float [[CALL_I]]
+// FINITEONLY-NEXT:[[TMP0:%.*]] = tail call nnan ninf contract float 
@llvm.ceil.f32(float [[X:%.*]])
+// FINITEONLY-NEXT:ret float [[TMP0]]
 //
 extern "C" __device__ float test_ceilf(float x) {
   return ceilf(x);
@@ -489,13 +489,13 @@ extern "C" __device__ float test_ceilf(float x) {
 
 // DEFAULT-LABEL: @test_ceil(
 // DEFAULT-NEXT:  entry:
-// DEFAULT-NEXT:[[CALL_I:%.*]] = tail call contract double 
@__ocml_ceil_f64(double noundef [[X:%.*]]) #[[ATTR14]]
-// DEFAULT-NEXT:ret double [[CALL_I]]
+// DEFAULT-NEXT:[[TMP0:%.*]] = tail call contract double 
@llvm.ceil.f64(double [[X:%.*]])
+// DEFAULT-NEXT:ret double [[TMP0]]
 //
 // FINITEONLY-LABEL: @test_ceil(
 // FINITEONLY-NEXT:  entry:
-// FINITEONLY-NEXT:[[CALL_I:%.*]] = tail call nnan ninf contract 
nofpclass(nan inf) double @__ocml_ceil_f64(double noundef nofpclass(nan inf) 
[[X:%.*]]) #[[ATTR14]]
-// FINITEONLY-NEXT:ret double [[CALL_I]]
+// FINITEONLY-NEXT:[[TMP0:%.*]] = tail call nnan ninf contract double 
@llvm.ceil.f64(double [[X:%.*]])
+// FINITEONLY-NEXT:ret double [[TMP0]]
 //
 extern "C" __device__ double test_ceil(double x) {
   return ceil(x);



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


[clang] 9a31751 - HIP: Directly call round builtins

2023-07-07 Thread Matt Arsenault via cfe-commits

Author: Matt Arsenault
Date: 2023-07-07T09:26:40-04:00
New Revision: 9a317516a515f3c5b15f9060329a503e8f261c7f

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

LOG: HIP: Directly call round builtins

Added: 


Modified: 
clang/lib/Headers/__clang_hip_math.h
clang/test/Headers/__clang_hip_math.hip

Removed: 




diff  --git a/clang/lib/Headers/__clang_hip_math.h 
b/clang/lib/Headers/__clang_hip_math.h
index c67f20873253b0..8a90c4acd94105 100644
--- a/clang/lib/Headers/__clang_hip_math.h
+++ b/clang/lib/Headers/__clang_hip_math.h
@@ -312,7 +312,7 @@ __DEVICE__
 long long int llrintf(float __x) { return __ocml_rint_f32(__x); }
 
 __DEVICE__
-long long int llroundf(float __x) { return __ocml_round_f32(__x); }
+long long int llroundf(float __x) { return __builtin_roundf(__x); }
 
 __DEVICE__
 float log10f(float __x) { return __ocml_log10_f32(__x); }
@@ -333,7 +333,7 @@ __DEVICE__
 long int lrintf(float __x) { return __ocml_rint_f32(__x); }
 
 __DEVICE__
-long int lroundf(float __x) { return __ocml_round_f32(__x); }
+long int lroundf(float __x) { return __builtin_roundf(__x); }
 
 __DEVICE__
 float modff(float __x, float *__iptr) {
@@ -460,7 +460,7 @@ float rnormf(int __dim,
 }
 
 __DEVICE__
-float roundf(float __x) { return __ocml_round_f32(__x); }
+float roundf(float __x) { return __builtin_roundf(__x); }
 
 __DEVICE__
 float rsqrtf(float __x) { return __ocml_rsqrt_f32(__x); }
@@ -860,7 +860,7 @@ __DEVICE__
 long long int llrint(double __x) { return __ocml_rint_f64(__x); }
 
 __DEVICE__
-long long int llround(double __x) { return __ocml_round_f64(__x); }
+long long int llround(double __x) { return __builtin_round(__x); }
 
 __DEVICE__
 double log(double __x) { return __ocml_log_f64(__x); }
@@ -881,7 +881,7 @@ __DEVICE__
 long int lrint(double __x) { return __ocml_rint_f64(__x); }
 
 __DEVICE__
-long int lround(double __x) { return __ocml_round_f64(__x); }
+long int lround(double __x) { return __builtin_round(__x); }
 
 __DEVICE__
 double modf(double __x, double *__iptr) {
@@ -1016,7 +1016,7 @@ double rnorm4d(double __x, double __y, double __z, double 
__w) {
 }
 
 __DEVICE__
-double round(double __x) { return __ocml_round_f64(__x); }
+double round(double __x) { return __builtin_round(__x); }
 
 __DEVICE__
 double rsqrt(double __x) { return __ocml_rsqrt_f64(__x); }

diff  --git a/clang/test/Headers/__clang_hip_math.hip 
b/clang/test/Headers/__clang_hip_math.hip
index a6797b01f25b27..35f637b912f439 100644
--- a/clang/test/Headers/__clang_hip_math.hip
+++ b/clang/test/Headers/__clang_hip_math.hip
@@ -1515,14 +1515,14 @@ extern "C" __device__ long long int test_llrint(double 
x) {
 
 // DEFAULT-LABEL: @test_llroundf(
 // DEFAULT-NEXT:  entry:
-// DEFAULT-NEXT:[[CALL_I:%.*]] = tail call contract float 
@__ocml_round_f32(float noundef [[X:%.*]]) #[[ATTR14]]
-// DEFAULT-NEXT:[[CONV_I:%.*]] = fptosi float [[CALL_I]] to i64
+// DEFAULT-NEXT:[[TMP0:%.*]] = tail call contract float 
@llvm.round.f32(float [[X:%.*]])
+// DEFAULT-NEXT:[[CONV_I:%.*]] = fptosi float [[TMP0]] to i64
 // DEFAULT-NEXT:ret i64 [[CONV_I]]
 //
 // FINITEONLY-LABEL: @test_llroundf(
 // FINITEONLY-NEXT:  entry:
-// FINITEONLY-NEXT:[[CALL_I:%.*]] = tail call nnan ninf contract 
nofpclass(nan inf) float @__ocml_round_f32(float noundef nofpclass(nan inf) 
[[X:%.*]]) #[[ATTR14]]
-// FINITEONLY-NEXT:[[CONV_I:%.*]] = fptosi float [[CALL_I]] to i64
+// FINITEONLY-NEXT:[[TMP0:%.*]] = tail call nnan ninf contract float 
@llvm.round.f32(float [[X:%.*]])
+// FINITEONLY-NEXT:[[CONV_I:%.*]] = fptosi float [[TMP0]] to i64
 // FINITEONLY-NEXT:ret i64 [[CONV_I]]
 //
 extern "C" __device__ long long int test_llroundf(float x) {
@@ -1531,14 +1531,14 @@ extern "C" __device__ long long int test_llroundf(float 
x) {
 
 // DEFAULT-LABEL: @test_llround(
 // DEFAULT-NEXT:  entry:
-// DEFAULT-NEXT:[[CALL_I:%.*]] = tail call contract double 
@__ocml_round_f64(double noundef [[X:%.*]]) #[[ATTR14]]
-// DEFAULT-NEXT:[[CONV_I:%.*]] = fptosi double [[CALL_I]] to i64
+// DEFAULT-NEXT:[[TMP0:%.*]] = tail call contract double 
@llvm.round.f64(double [[X:%.*]])
+// DEFAULT-NEXT:[[CONV_I:%.*]] = fptosi double [[TMP0]] to i64
 // DEFAULT-NEXT:ret i64 [[CONV_I]]
 //
 // FINITEONLY-LABEL: @test_llround(
 // FINITEONLY-NEXT:  entry:
-// FINITEONLY-NEXT:[[CALL_I:%.*]] = tail call nnan ninf contract 
nofpclass(nan inf) double @__ocml_round_f64(double noundef nofpclass(nan inf) 
[[X:%.*]]) #[[ATTR14]]
-// FINITEONLY-NEXT:[[CONV_I:%.*]] = fptosi double [[CALL_I]] to i64
+// FINITEONLY-NEXT:[[TMP0:%.*]] = tail call nnan ninf contract double 
@llvm.round.f64(double [[X:%.*]])
+// FINITEONLY-NEXT:[[CONV_I:%.*]] = fptosi double [[TMP0]] to i64
 // FINITEONLY-NEXT:ret i64 [[CONV_I]]
 //

[PATCH] D154000: HIP: Directly call round builtins

2023-07-07 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm closed this revision.
arsenm added a comment.

9a317516a515f3c5b15f9060329a503e8f261c7f


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

https://reviews.llvm.org/D154000

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


[PATCH] D154716: [SemaCXX] Fix bug where unexpanded lambda captures where assumed to be expanded

2023-07-07 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok created this revision.
Herald added a project: All.
MitalAshok edited the summary of this revision.
MitalAshok added reviewers: rsmith, cor3ntin.
MitalAshok published this revision for review.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

When instantiating the closure type of a lambda in a template, sometimes a 
capture which is a pack is not expanded. When that happens, it is replaced with 
a pack of size 1 containing that pack. Before it is replaced by another 
instantiation where the pack is expanded, the size is reported to be 1 instead 
of unknown.

This checks if this is happening (i.e., trying to replace a pack declaration 
with a single declaration that is itself a pack), and not expanding it out in 
that case.

Fixes https://github.com/llvm/llvm-project/issues/63677


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D154716

Files:
  clang/lib/Sema/SemaTemplateInstantiate.cpp
  clang/lib/Sema/TreeTransform.h
  clang/test/SemaCXX/lambda-pack-expansion.cpp


Index: clang/test/SemaCXX/lambda-pack-expansion.cpp
===
--- clang/test/SemaCXX/lambda-pack-expansion.cpp
+++ clang/test/SemaCXX/lambda-pack-expansion.cpp
@@ -21,3 +21,18 @@
   take_by_ref(x);
 }
 }
+
+namespace GH63677 {
+
+template
+void f() {
+[]() -> void {
+[...us = Ts{}]{
+(Ts(us), ...);
+};
+}.template operator()();
+}
+
+template void f();
+
+}
Index: clang/lib/Sema/TreeTransform.h
===
--- clang/lib/Sema/TreeTransform.h
+++ clang/lib/Sema/TreeTransform.h
@@ -13340,14 +13340,14 @@
   OldVD->getInit()->getSourceRange(), Unexpanded, Expand,
   RetainExpansion, NumExpansions))
 return ExprError();
+  assert(!RetainExpansion && "Should not need to retain expansion after a "
+ "capture since it cannot be extended");
   if (Expand) {
 for (unsigned I = 0; I != *NumExpansions; ++I) {
   Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
   SubstInitCapture(SourceLocation(), std::nullopt);
 }
-  }
-  if (!Expand || RetainExpansion) {
-ForgetPartiallySubstitutedPackRAII Forget(getDerived());
+  } else {
 SubstInitCapture(ExpansionTL.getEllipsisLoc(), NumExpansions);
 Result.EllipsisLoc = ExpansionTL.getEllipsisLoc();
   }
Index: clang/lib/Sema/SemaTemplateInstantiate.cpp
===
--- clang/lib/Sema/SemaTemplateInstantiate.cpp
+++ clang/lib/Sema/SemaTemplateInstantiate.cpp
@@ -1270,7 +1270,8 @@
 }
 
 void transformedLocalDecl(Decl *Old, ArrayRef NewDecls) {
-  if (Old->isParameterPack()) {
+  if (Old->isParameterPack() &&
+  (NewDecls.size() != 1 || !NewDecls.front()->isParameterPack())) {
 SemaRef.CurrentInstantiationScope->MakeInstantiatedLocalArgPack(Old);
 for (auto *New : NewDecls)
   SemaRef.CurrentInstantiationScope->InstantiatedLocalPackArg(


Index: clang/test/SemaCXX/lambda-pack-expansion.cpp
===
--- clang/test/SemaCXX/lambda-pack-expansion.cpp
+++ clang/test/SemaCXX/lambda-pack-expansion.cpp
@@ -21,3 +21,18 @@
   take_by_ref(x);
 }
 }
+
+namespace GH63677 {
+
+template
+void f() {
+[]() -> void {
+[...us = Ts{}]{
+(Ts(us), ...);
+};
+}.template operator()();
+}
+
+template void f();
+
+}
Index: clang/lib/Sema/TreeTransform.h
===
--- clang/lib/Sema/TreeTransform.h
+++ clang/lib/Sema/TreeTransform.h
@@ -13340,14 +13340,14 @@
   OldVD->getInit()->getSourceRange(), Unexpanded, Expand,
   RetainExpansion, NumExpansions))
 return ExprError();
+  assert(!RetainExpansion && "Should not need to retain expansion after a "
+ "capture since it cannot be extended");
   if (Expand) {
 for (unsigned I = 0; I != *NumExpansions; ++I) {
   Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(getSema(), I);
   SubstInitCapture(SourceLocation(), std::nullopt);
 }
-  }
-  if (!Expand || RetainExpansion) {
-ForgetPartiallySubstitutedPackRAII Forget(getDerived());
+  } else {
 SubstInitCapture(ExpansionTL.getEllipsisLoc(), NumExpansions);
 Result.EllipsisLoc = ExpansionTL.getEllipsisLoc();
   }
Index: clang/lib/Sema/SemaTemplateInstantiate.cpp
===
--- clang/lib/Sema/SemaTemplateInstantiate.cpp
+++ clang/lib/Sema/SemaTemplateInstantiate.cpp
@@ -1270,7 +1270,8 @@
 }
 
 void transformedLocalDecl(Decl *Old, ArrayRef NewDecls) {
-  if (Old->isParameterPack()) {
+  if (Old->isParameterPack() &&
+  (NewDecls

[PATCH] D154550: [clang-format] Allow empty loops on a single line.

2023-07-07 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks accepted this revision.
HazardyKnusperkeks added a comment.
This revision is now accepted and ready to land.

Please wait for other opinions.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154550

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


[PATCH] D154484: [clang-format] Add an option to remove redundant parentheses

2023-07-07 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks added inline comments.



Comment at: clang/unittests/Format/FormatTest.cpp:25808
 
+TEST_F(FormatTest, RemoveParentheses) {
+  FormatStyle Style = getLLVMStyle();

owenpan wrote:
> HazardyKnusperkeks wrote:
> > Should check for `__attribute((what ever))__`.
> What's special about this? It's agnostic about this option as it should be.
I did not see, that you already had an example with `__attribute__`.


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

https://reviews.llvm.org/D154484

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


[PATCH] D154591: [OpenMP][OMPIRBuilder] Rename IsEmbedded and IsTargetCodegen flags

2023-07-07 Thread Sergio Afonso via Phabricator via cfe-commits
skatrak updated this revision to Diff 538135.
skatrak added a comment.

Rebase and fix issues.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154591

Files:
  clang/docs/OffloadingDesign.rst
  clang/include/clang/Basic/LangOptions.def
  clang/include/clang/Driver/Options.td
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/Decl.cpp
  clang/lib/AST/ItaniumMangle.cpp
  clang/lib/AST/OpenMPClause.cpp
  clang/lib/Basic/Targets/NVPTX.cpp
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGDecl.cpp
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGOpenMPRuntime.h
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.h
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/lib/CodeGen/CGVTables.cpp
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/CodeGen/Targets/NVPTX.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Driver/ToolChains/Flang.cpp
  clang/lib/Frontend/CompilerInstance.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/lib/Frontend/InitPreprocessor.cpp
  clang/lib/Lex/LiteralSupport.cpp
  clang/lib/Sema/Sema.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaOpenMP.cpp
  clang/lib/Sema/SemaType.cpp
  clang/test/CodeGen/PowerPC/ppc64le-varargs-f128.c
  clang/test/CodeGen/ibm128-unsupported.c
  clang/test/Driver/openmp-offload-gpu.c
  clang/test/Driver/openmp-offload.c
  clang/test/Headers/__clang_hip_libdevice_declares.cpp
  clang/test/Headers/amdgcn-openmp-device-math-complex.c
  clang/test/Headers/amdgcn-openmp-device-math-complex.cpp
  clang/test/Headers/amdgcn_openmp_device_math.c
  clang/test/Headers/amdgcn_openmp_device_math_c.c
  clang/test/Headers/amdgcn_openmp_device_math_constexpr.cpp
  clang/test/Headers/nvptx_device_cmath_functions.c
  clang/test/Headers/nvptx_device_cmath_functions.cpp
  clang/test/Headers/nvptx_device_cmath_functions_cxx17.cpp
  clang/test/Headers/nvptx_device_math_complex.c
  clang/test/Headers/nvptx_device_math_complex.cpp
  clang/test/Headers/nvptx_device_math_functions.c
  clang/test/Headers/nvptx_device_math_functions.cpp
  clang/test/Headers/nvptx_device_math_functions_cxx17.cpp
  clang/test/Headers/nvptx_device_math_macro.cpp
  clang/test/Headers/nvptx_device_math_modf.cpp
  clang/test/Headers/nvptx_device_math_sin.c
  clang/test/Headers/nvptx_device_math_sin.cpp
  clang/test/Headers/nvptx_device_math_sin_cos.cpp
  clang/test/Headers/nvptx_device_math_sincos.cpp
  clang/test/Headers/openmp-device-functions-bool.c
  clang/test/Headers/openmp_device_math_isnan.cpp
  clang/test/Headers/openmp_new_nothrow.cpp
  clang/test/Headers/target_include_new.cpp
  clang/test/OpenMP/amdgcn-attributes.cpp
  clang/test/OpenMP/amdgcn_device_function_call.cpp
  clang/test/OpenMP/amdgcn_ldbl_check.cpp
  clang/test/OpenMP/amdgcn_target_codegen.cpp
  clang/test/OpenMP/amdgcn_target_device_vla.cpp
  clang/test/OpenMP/amdgcn_target_global_constructor.cpp
  clang/test/OpenMP/amdgcn_target_init_temp_alloca.cpp
  clang/test/OpenMP/amdgpu_target_with_aligned_attribute.c
  clang/test/OpenMP/assumes_include_nvptx.cpp
  clang/test/OpenMP/aux-triple-macros.cpp
  clang/test/OpenMP/declare_target_codegen.cpp
  clang/test/OpenMP/declare_target_codegen_globalization.cpp
  clang/test/OpenMP/declare_target_constexpr_codegen.cpp
  clang/test/OpenMP/declare_target_link_codegen.cpp
  clang/test/OpenMP/declare_target_messages.cpp
  clang/test/OpenMP/declare_target_only_one_side_compilation.cpp
  clang/test/OpenMP/declare_variant_device_kind_codegen.cpp
  clang/test/OpenMP/declare_variant_mixed_codegen.c
  clang/test/OpenMP/distribute_codegen.cpp
  clang/test/OpenMP/distribute_simd_codegen.cpp
  clang/test/OpenMP/metadirective_device_arch_codegen.cpp
  clang/test/OpenMP/metadirective_device_isa_codegen_amdgcn.cpp
  clang/test/OpenMP/multiple_regions_per_line.cpp
  clang/test/OpenMP/nvptx_NRVO_variable.cpp
  clang/test/OpenMP/nvptx_SPMD_codegen.cpp
  clang/test/OpenMP/nvptx_allocate_codegen.cpp
  clang/test/OpenMP/nvptx_allocate_messages.cpp
  clang/test/OpenMP/nvptx_asm_delayed_diags.c
  clang/test/OpenMP/nvptx_data_sharing.cpp
  clang/test/OpenMP/nvptx_declare_target_var_ctor_dtor_codegen.cpp
  clang/test/OpenMP/nvptx_declare_variant_device_kind_codegen.cpp
  clang/test/OpenMP/nvptx_declare_variant_implementation_vendor_codegen.cpp
  clang/test/OpenMP/nvptx_declare_variant_name_mangling.cpp
  clang/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/nvptx_multi_target_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_nested_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_codegen.cpp
  clang/test/OpenMP/nvptx_parallel_for_codegen.cpp
  clang/test/OpenMP/nvptx_param_translate.c
  clang/test/OpenMP/nvptx_prohibit_thread_local.cpp
  clang/test/OpenMP/nvptx_target_codegen.cpp
  clang/test/OpenMP/nvptx_tar

[clang] 051cb7c - [amdgpu] start documenting amdgpu support by clang

2023-07-07 Thread Yaxun Liu via cfe-commits

Author: Yaxun (Sam) Liu
Date: 2023-07-07T10:35:34-04:00
New Revision: 051cb7c1f57dd769ad05a5dc1d734d2ecd46530c

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

LOG: [amdgpu] start documenting amdgpu support by clang

Reviewed by: Matt Arsenault, Johannes Doerfert, Jacob Lambert

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

Added: 
clang/docs/AMDGPUSupport.rst

Modified: 


Removed: 




diff  --git a/clang/docs/AMDGPUSupport.rst b/clang/docs/AMDGPUSupport.rst
new file mode 100644
index 00..e63c0e1ba7d67b
--- /dev/null
+++ b/clang/docs/AMDGPUSupport.rst
@@ -0,0 +1,63 @@
+.. raw:: html
+
+  
+.none { background-color: #FF }
+.part { background-color: #99 }
+.good { background-color: #CCFF99 }
+  
+
+.. role:: none
+.. role:: part
+.. role:: good
+
+.. contents::
+   :local:
+
+==
+AMDGPU Support
+==
+
+Clang supports OpenCL, HIP and OpenMP on AMD GPU targets.
+
+
+Predefined Macros
+=
+
+
+.. list-table::
+   :header-rows: 1
+
+   * - Macro
+ - Description
+   * - ``__AMDGPU__``
+ - Indicates that the code is being compiled for an AMD GPU.
+   * - ``__AMDGCN__``
+ - Defined if the GPU target is AMDGCN.
+   * - ``__R600__``
+ - Defined if the GPU target is R600.
+   * - ````
+ - Defined with the name of the architecture (e.g., ``__gfx906__`` for the 
gfx906 architecture).
+   * - ````
+ - Defines the GFX family (e.g., for gfx906, this macro would be 
``__GFX9__``).
+   * - ``__amdgcn_processor__``
+ - Defined with the processor name as a string (e.g., ``"gfx906"``).
+   * - ``__amdgcn_target_id__``
+ - Defined with the target ID as a string.
+   * - ``__amdgcn_feature___``
+ - Defined for each supported target feature. The value is 1 if the 
feature is enabled and 0 if it is disabled. Allowed feature names are sramecc 
and xnack.
+   * - ``__AMDGCN_CUMODE__``
+ - Defined as 1 if the CU mode is enabled and 0 if the WGP mode is enabled.
+   * - ``__AMDGCN_UNSAFE_FP_ATOMICS__``
+ - Defined if unsafe floating-point atomics are allowed.
+   * - ``__AMDGCN_WAVEFRONT_SIZE__``
+ - Defines the wavefront size. Allowed values are 32 and 64.
+   * - ``__AMDGCN_WAVEFRONT_SIZE``
+ - Alias to ``__AMDGCN_WAVEFRONT_SIZE__``. To be deprecated.
+   * - ``__HAS_FMAF__``
+ - Defined if FMAF instruction is available (deprecated).
+   * - ``__HAS_LDEXPF__``
+ - Defined if LDEXPF instruction is available (deprecated).
+   * - ``__HAS_FP64__``
+ - Defined if FP64 instruction is available (deprecated).
+
+Please note that the specific architecture and feature names will vary 
depending on the GPU. Also, some macros are deprecated and may be removed in 
future releases.



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


[PATCH] D154133: [amdgpu] start documenting amdgpu support by clang

2023-07-07 Thread Yaxun Liu 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 rG051cb7c1f57d: [amdgpu] start documenting amdgpu support by 
clang (authored by yaxunl).
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154133

Files:
  clang/docs/AMDGPUSupport.rst


Index: clang/docs/AMDGPUSupport.rst
===
--- /dev/null
+++ clang/docs/AMDGPUSupport.rst
@@ -0,0 +1,63 @@
+.. raw:: html
+
+  
+.none { background-color: #FF }
+.part { background-color: #99 }
+.good { background-color: #CCFF99 }
+  
+
+.. role:: none
+.. role:: part
+.. role:: good
+
+.. contents::
+   :local:
+
+==
+AMDGPU Support
+==
+
+Clang supports OpenCL, HIP and OpenMP on AMD GPU targets.
+
+
+Predefined Macros
+=
+
+
+.. list-table::
+   :header-rows: 1
+
+   * - Macro
+ - Description
+   * - ``__AMDGPU__``
+ - Indicates that the code is being compiled for an AMD GPU.
+   * - ``__AMDGCN__``
+ - Defined if the GPU target is AMDGCN.
+   * - ``__R600__``
+ - Defined if the GPU target is R600.
+   * - ````
+ - Defined with the name of the architecture (e.g., ``__gfx906__`` for the 
gfx906 architecture).
+   * - ````
+ - Defines the GFX family (e.g., for gfx906, this macro would be 
``__GFX9__``).
+   * - ``__amdgcn_processor__``
+ - Defined with the processor name as a string (e.g., ``"gfx906"``).
+   * - ``__amdgcn_target_id__``
+ - Defined with the target ID as a string.
+   * - ``__amdgcn_feature___``
+ - Defined for each supported target feature. The value is 1 if the 
feature is enabled and 0 if it is disabled. Allowed feature names are sramecc 
and xnack.
+   * - ``__AMDGCN_CUMODE__``
+ - Defined as 1 if the CU mode is enabled and 0 if the WGP mode is enabled.
+   * - ``__AMDGCN_UNSAFE_FP_ATOMICS__``
+ - Defined if unsafe floating-point atomics are allowed.
+   * - ``__AMDGCN_WAVEFRONT_SIZE__``
+ - Defines the wavefront size. Allowed values are 32 and 64.
+   * - ``__AMDGCN_WAVEFRONT_SIZE``
+ - Alias to ``__AMDGCN_WAVEFRONT_SIZE__``. To be deprecated.
+   * - ``__HAS_FMAF__``
+ - Defined if FMAF instruction is available (deprecated).
+   * - ``__HAS_LDEXPF__``
+ - Defined if LDEXPF instruction is available (deprecated).
+   * - ``__HAS_FP64__``
+ - Defined if FP64 instruction is available (deprecated).
+
+Please note that the specific architecture and feature names will vary 
depending on the GPU. Also, some macros are deprecated and may be removed in 
future releases.


Index: clang/docs/AMDGPUSupport.rst
===
--- /dev/null
+++ clang/docs/AMDGPUSupport.rst
@@ -0,0 +1,63 @@
+.. raw:: html
+
+  
+.none { background-color: #FF }
+.part { background-color: #99 }
+.good { background-color: #CCFF99 }
+  
+
+.. role:: none
+.. role:: part
+.. role:: good
+
+.. contents::
+   :local:
+
+==
+AMDGPU Support
+==
+
+Clang supports OpenCL, HIP and OpenMP on AMD GPU targets.
+
+
+Predefined Macros
+=
+
+
+.. list-table::
+   :header-rows: 1
+
+   * - Macro
+ - Description
+   * - ``__AMDGPU__``
+ - Indicates that the code is being compiled for an AMD GPU.
+   * - ``__AMDGCN__``
+ - Defined if the GPU target is AMDGCN.
+   * - ``__R600__``
+ - Defined if the GPU target is R600.
+   * - ````
+ - Defined with the name of the architecture (e.g., ``__gfx906__`` for the gfx906 architecture).
+   * - ````
+ - Defines the GFX family (e.g., for gfx906, this macro would be ``__GFX9__``).
+   * - ``__amdgcn_processor__``
+ - Defined with the processor name as a string (e.g., ``"gfx906"``).
+   * - ``__amdgcn_target_id__``
+ - Defined with the target ID as a string.
+   * - ``__amdgcn_feature___``
+ - Defined for each supported target feature. The value is 1 if the feature is enabled and 0 if it is disabled. Allowed feature names are sramecc and xnack.
+   * - ``__AMDGCN_CUMODE__``
+ - Defined as 1 if the CU mode is enabled and 0 if the WGP mode is enabled.
+   * - ``__AMDGCN_UNSAFE_FP_ATOMICS__``
+ - Defined if unsafe floating-point atomics are allowed.
+   * - ``__AMDGCN_WAVEFRONT_SIZE__``
+ - Defines the wavefront size. Allowed values are 32 and 64.
+   * - ``__AMDGCN_WAVEFRONT_SIZE``
+ - Alias to ``__AMDGCN_WAVEFRONT_SIZE__``. To be deprecated.
+   * - ``__HAS_FMAF__``
+ - Defined if FMAF instruction is available (deprecated).
+   * - ``__HAS_LDEXPF__``
+ - Defined if LDEXPF instruction is available (deprecated).
+   * - ``__HAS_FP64__``
+ - Defined if FP64 instruction is available (deprecated).
+
+Please note that the specific architecture and feature names will vary depending on the GPU. Also

[clang] d54cad7 - [Clang][NFC] Mark that P2280 was approved as a DR

2023-07-07 Thread via cfe-commits

Author: cor3ntin
Date: 2023-07-07T16:36:47+02:00
New Revision: d54cad79857fdb7af7fac4a2718238e5d4c8273b

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

LOG: [Clang][NFC] Mark that P2280 was approved as a DR

Added: 


Modified: 
clang/www/cxx_status.html

Removed: 




diff  --git a/clang/www/cxx_status.html b/clang/www/cxx_status.html
index 196a318c2b0b0d..06fb116da9e72a 100755
--- a/clang/www/cxx_status.html
+++ b/clang/www/cxx_status.html
@@ -356,7 +356,7 @@ C++23 implementation status
 
 
   Using unknown pointers and references in constant expressions
-  https://wg21.link/P2280R4";>P2280R4
+  https://wg21.link/P2280R4";>P2280R4 (DR)
   No
 
 



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


[PATCH] D105759: Implement P2361 Unevaluated string literals

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



Comment at: clang/docs/ReleaseNotes.rst:138
 - Implemented `P2738R1: constexpr cast from void* 
`_.
+- Partially implemented `P2361R6: constexpr cast from void* 
`_.
+  The changes to attributes declarations are not part of this release.

Looks like a copy&paste bug.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105759

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


[PATCH] D105759: Implement P2361 Unevaluated string literals

2023-07-07 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin added inline comments.



Comment at: clang/docs/ReleaseNotes.rst:138
 - Implemented `P2738R1: constexpr cast from void* 
`_.
+- Partially implemented `P2361R6: constexpr cast from void* 
`_.
+  The changes to attributes declarations are not part of this release.

barannikov88 wrote:
> Looks like a copy&paste bug.
Nice catch, thanks


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105759

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


[clang] c5301cc - [Clang][NFC] Fix the title of P2361 in the release notes

2023-07-07 Thread Corentin Jabot via cfe-commits

Author: Corentin Jabot
Date: 2023-07-07T16:41:17+02:00
New Revision: c5301cc5ce5edc56ba5ec27bb79ec2b2957d1974

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

LOG: [Clang][NFC] Fix the title of P2361 in the release notes

Added: 


Modified: 
clang/docs/ReleaseNotes.rst

Removed: 




diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 35caf85725c140..1ae7b8377e3e4e 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -135,7 +135,7 @@ C++2c Feature Support
 ^
 - Compiler flags ``-std=c++2c`` and ``-std=gnu++2c`` have been added for 
experimental C++2c implementation work.
 - Implemented `P2738R1: constexpr cast from void* 
`_.
-- Partially implemented `P2361R6: constexpr cast from void* 
`_.
+- Partially implemented `P2361R6: Unevaluated strings 
`_.
   The changes to attributes declarations are not part of this release.
 
 Resolutions to C++ Defect Reports



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


[PATCH] D154130: [lit] Avoid os.path.realpath on Windows due to MAX_PATH limitations

2023-07-07 Thread Tristan Labelle via Phabricator via cfe-commits
MrTrillian added a comment.

All premerge build failures seem like flukes.

- `x64 windows` failed 1/3 times
- `x64 debian` failed 2/3 times with a timeout (passes locally)
- `libcxx` seems to be failing for everyone: 
https://buildkite.com/llvm-project/libcxx-ci


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154130

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


[PATCH] D154130: [lit] Avoid os.path.realpath on Windows due to MAX_PATH limitations

2023-07-07 Thread Tristan Labelle via Phabricator via cfe-commits
MrTrillian added a comment.

@rnk , I would appreciate your review on this since you helped with the 
previous iteration.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154130

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


[clang] 5e9ab9c - Fix the Clang sphinx bot

2023-07-07 Thread Aaron Ballman via cfe-commits

Author: Aaron Ballman
Date: 2023-07-07T11:08:17-04:00
New Revision: 5e9ab9c615c3b108b05d729a5706dd46f5ebdc97

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

LOG: Fix the Clang sphinx bot

This adds AMDGPUSupport to the index page to address the issue found by:
https://lab.llvm.org/buildbot/#/builders/92/builds/46936

Added: 


Modified: 
clang/docs/index.rst

Removed: 




diff  --git a/clang/docs/index.rst b/clang/docs/index.rst
index 9fc7c6fff701e4..7d08cea95db19b 100644
--- a/clang/docs/index.rst
+++ b/clang/docs/index.rst
@@ -51,6 +51,7 @@ Using Clang as a Compiler
ThinLTO
APINotes
DebuggingCoroutines
+   AMDGPUSupport
CommandGuide/index
FAQ
 



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


[PATCH] D149248: [RISCV][MC] MC layer support for the experimental zacas extension

2023-07-07 Thread Philip Reames via Phabricator via cfe-commits
reames accepted this revision.
reames added a comment.
This revision is now accepted and ready to land.

LGTM




Comment at: llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp:3338
+unsigned Rs2 = Inst.getOperand(2).getReg();
+if (Rd % 2 == 1) {
+  SMLoc Loc = Operands[1]->getStartLoc();

Very minor, but != 0 would read more naturally for me here.  Checking for odd, 
and then an error message about even requires one extra second of thought.

Same with the one below.


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

https://reviews.llvm.org/D149248

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


[PATCH] D154290: [WIP][Clang] Implement P2741R3 - user-generated static_assert messages

2023-07-07 Thread Corentin Jabot via Phabricator via cfe-commits
cor3ntin updated this revision to Diff 538154.
cor3ntin added a comment.

Rebase.
This is now ready for review.

Note that after discussion with CWG, the consensus seems to be that the wording 
is fine, an implementation has to behave

As if the full expression Message.data()[I] is called for each character.
Obviously this is not a viable implementation strategy so we materialize
intermediate expressions.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154290

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/AST/DeclCXX.h
  clang/include/clang/AST/Expr.h
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/DeclCXX.cpp
  clang/lib/AST/DeclPrinter.cpp
  clang/lib/AST/ExprConstant.cpp
  clang/lib/AST/ODRDiagsEmitter.cpp
  clang/lib/Frontend/InitPreprocessor.cpp
  clang/lib/Parse/ParseDeclCXX.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
  clang/test/Lexer/cxx-features.cpp
  clang/test/SemaCXX/static-assert-cxx26.cpp
  clang/tools/libclang/CIndex.cpp
  clang/www/cxx_status.html

Index: clang/www/cxx_status.html
===
--- clang/www/cxx_status.html
+++ clang/www/cxx_status.html
@@ -145,7 +145,7 @@
  
   User-generated static_assert messages
   https://wg21.link/P2741R3";>P2741R3
-  No
+  Clang 17
  
  
   Placeholder variables with no name
Index: clang/tools/libclang/CIndex.cpp
===
--- clang/tools/libclang/CIndex.cpp
+++ clang/tools/libclang/CIndex.cpp
@@ -1294,7 +1294,7 @@
 bool CursorVisitor::VisitStaticAssertDecl(StaticAssertDecl *D) {
   if (Visit(MakeCXCursor(D->getAssertExpr(), StmtParent, TU, RegionOfInterest)))
 return true;
-  if (StringLiteral *Message = D->getMessage())
+  if (auto *Message = dyn_cast(D->getMessage()))
 if (Visit(MakeCXCursor(Message, StmtParent, TU, RegionOfInterest)))
   return true;
   return false;
Index: clang/test/SemaCXX/static-assert-cxx26.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/static-assert-cxx26.cpp
@@ -0,0 +1,127 @@
+// RUN: %clang_cc1 -std=c++2c -fsyntax-only %s -verify
+
+static_assert(true, "");
+static_assert(true, 0); // expected-error {{the message in a static_assert declaration must be a string literal or an object with data() and size() member functions}}
+struct Empty{};
+static_assert(true, Empty{}); // expected-error {{the message in a static_assert declaration must be a string literal or an object with data() and size() member functions}}
+struct NoData {
+unsigned long size() const;
+};
+struct NoSize {
+const char* data() const;
+};
+static_assert(true, NoData{}); // expected-error {{the message in a static_assert declaration must be a string literal or an object with data() and size() member functions}}
+static_assert(true, NoSize{}); // expected-error {{the message in a static_assert declaration must be a string literal or an object with data() and size() member functions}}
+
+struct InvalidSize {
+const char* size() const;
+const char* data() const;
+};
+static_assert(true, InvalidSize{}); // expected-error {{the message in a static_assert declaration must have a size() member function returning an object convertible to std::size_t}} \
+// expected-error {{value of type 'const char *' is not implicitly convertible to 'unsigned long'}}
+struct InvalidData {
+unsigned long size() const;
+unsigned long data() const;
+};
+static_assert(true, InvalidData{}); // expected-error {{the message in a static_assert declaration must have a data() member function returning an object convertible to const char*}} \
+// expected-error {{value of type 'unsigned long' is not implicitly convertible to 'const char *'}}
+
+struct NonConstexprSize {
+unsigned long size() const; // expected-note {{declared here}}
+constexpr const char* data() const;
+};
+
+static_assert(true, NonConstexprSize{});
+static_assert(false, NonConstexprSize{}); // expected-error {{the message in a static_assert declaration must be produced by constant expression}} \
+  // expected-error {{static assertion failed}} \
+  // expected-note  {{non-constexpr function 'size' cannot be used in a constant expression}}
+
+struct NonConstexprData {
+constexpr unsigned long size() const {
+return 32;
+}
+const char* data() const;  // expected-note {{declared here}}
+};
+
+static_assert(true, NonConstexprData{});
+static_assert(false, NonConstexprData{}); // expected-error {{the message in a static_assert declaration must be produced by constant expression}} \
+ 

[PATCH] D154290: [WIP][Clang] Implement P2741R3 - user-generated static_assert messages

2023-07-07 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added inline comments.



Comment at: clang/lib/Sema/SemaDeclCXX.cpp:16893
+
+  if (const StringLiteral *SL = dyn_cast(Message);
+  SL && SL->getCharByteWidth() == 1) {





Comment at: clang/lib/Sema/SemaDeclCXX.cpp:16898
+  }
+
+  QualType T = Message->getType().getNonReferenceType();

What if the message is ` StringLiteral` but `getCharByteWidth()` doesn't return 
`1`? We would get the `err_static_assert_invalid_message` because` !RD` is 
true, right?



Comment at: clang/lib/Sema/SemaDeclCXX.cpp:16900
+  QualType T = Message->getType().getNonReferenceType();
+  auto *RD = T->getAsCXXRecordDecl();
+  if (!RD) {





Comment at: clang/lib/Sema/SemaDeclCXX.cpp:16912
+  return std::nullopt;
+for (NamedDecl *D : MemberLookup) {
+  if (FunctionDecl *FD = dyn_cast(D->getUnderlyingDecl());





Comment at: clang/lib/Sema/SemaDeclCXX.cpp:16913
+for (NamedDecl *D : MemberLookup) {
+  if (FunctionDecl *FD = dyn_cast(D->getUnderlyingDecl());
+  FD && FD->getMinRequiredArguments() == 0 &&




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154290

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


[PATCH] D139629: clang: Stop emitting "strictfp"

2023-07-07 Thread Zahira Ammarguellat via Phabricator via cfe-commits
zahiraam added a subscriber: rjmccall.
zahiraam added a comment.

According to this comment https://reviews.llvm.org/D87528#2342132, it looks 
like @rjmccall had proposed the addition of the attribute. @rjmccall Do you 
recall why it was added?


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

https://reviews.llvm.org/D139629

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


[PATCH] D153418: Adding iconv support to CharSetConverter class

2023-07-07 Thread Abhina Sree via Phabricator via cfe-commits
abhina.sreeskantharajan added a comment.

In D153418#4478766 , @tahonermann 
wrote:

>> Please correct me if I'm wrong, I'm not too familiar with icu4c, but I think 
>> adding support for ICU would be the better long-term solution since it seems 
>> to allow the same behaviour across different platforms.
>
> I tend to agree. Additionally, as more Unicode support is added to C++, the 
> likelihood that we'll want to use other functionality from ICU increases.
>
>> However, the issue on the z/OS platform is that there currently isn't 
>> support for this library so iconv seems to be the only solution we can use 
>> until we do get support. So would an alternative be to use iconv only on 
>> z/OS (and hopefully this is a temporary solution until icu is supported on 
>> z/OS) and use icu on all other platforms?
>
> ICU isn't supported on z/OS because the historical z/OS compiler (xlC) never 
> gained support for C++11 or later so support for z/OS was dropped when ICU 
> moved to C++11. Now that IBM has embraced LLVM and Clang, I would expect it 
> to be possible to build ICU for z/OS again with moderate porting effort. It 
> would be great if someone from IBM could confirm whether such an effort is 
> underway (@hubert.reinterpretcast?).

We currently have no plan or resources allocated towards porting ICU on z/OS. 
Our users also rely on iconv for the system locales, but (and please correct me 
if I'm wrong) it seems like ICU does not use system locales so this may not 
meet our users' needs. So we would still prefer to have iconv support available 
at the very least for z/OS, even if ICU is the preferred default.

I'll also post the same reply on the RFC so we can continue the discussion there


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153418

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


[PATCH] D154423: [clang][analyzer] Add all success/failure messages to StdLibraryFunctionsChecker.

2023-07-07 Thread Balázs Kéri via Phabricator via cfe-commits
balazske added a comment.

The standard streams may need special handling, this can be useful for 
`StreamChecker` too. One problem is that the standard streams can be changed by 
the program, so we can not know for sure if these are the original values. 
Still it can be better to assume that `fileno` can not fail if used with the 
standard streams.
The result with `ftell` looks interesting, I checked this case already and I 
think the note tag is missing because there is a hidden conversion so the 
original symbol (that is set to interesting) is different than the real `ftell` 
function call.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154423

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


[PATCH] D154672: [OPENMP52] Deprecation of 'depend' clause in ordered directive.

2023-07-07 Thread Jennifer Yu via Phabricator via cfe-commits
jyu2 updated this revision to Diff 538162.
jyu2 added a comment.

Thanks @jdoerfert, @ABataev and @aaron.ballman for the code reviews.  This is 
addressing comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154672

Files:
  clang/include/clang/Basic/DiagnosticParseKinds.td
  clang/lib/Parse/ParseOpenMP.cpp
  clang/test/OpenMP/ordered_doacross_codegen.c
  clang/test/OpenMP/ordered_messages.cpp


Index: clang/test/OpenMP/ordered_messages.cpp
===
--- clang/test/OpenMP/ordered_messages.cpp
+++ clang/test/OpenMP/ordered_messages.cpp
@@ -402,6 +402,7 @@
   for (int i = 0; i < 10; ++i) { // expected-error {{expected 2 for loops 
after '#pragma omp for', but found only 1}}
 #if _OPENMP >= 202111
 #pragma omp ordered doacross(sink : i)
+#pragma omp ordered depend(source) // expected-warning {{'depend' clause for 
'ordered' is deprecated; use doacross instead}}
 int j;
 #pragma omp ordered doacross(sink : i, j) // omp52-error {{expected loop 
iteration variable}}
 #else
Index: clang/test/OpenMP/ordered_doacross_codegen.c
===
--- clang/test/OpenMP/ordered_doacross_codegen.c
+++ clang/test/OpenMP/ordered_doacross_codegen.c
@@ -2,21 +2,21 @@
 // RUN: %clang_cc1 -fopenmp -triple x86_64-unknown-unknown -emit-pch -o %t %s
 // RUN: %clang_cc1 -fopenmp -triple x86_64-unknown-unknown -include-pch %t 
-verify %s -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,CHECK-NORMAL
 
-// RUN: %clang_cc1 -verify -fopenmp -triple x86_64-unknown-unknown -emit-llvm 
%s -o - -fopenmp-version=52 | FileCheck %s --check-prefixes=CHECK,CHECK-NORMAL
+// RUN: %clang_cc1 -verify -fopenmp -triple x86_64-unknown-unknown -emit-llvm 
%s -o - -fopenmp-version=52 -DOMP52 | FileCheck %s 
--check-prefixes=CHECK,CHECK-NORMAL
 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-enable-irbuilder -triple 
x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s 
--check-prefixes=CHECK,CHECK-IRBUILDER
-// RUN: %clang_cc1 -verify -fopenmp -fopenmp-enable-irbuilder -triple 
x86_64-unknown-unknown -fopenmp-version=52 -emit-llvm %s -o - | FileCheck %s 
--check-prefixes=CHECK,CHECK-IRBUILDER
+// RUN: %clang_cc1 -verify -fopenmp -fopenmp-enable-irbuilder -triple 
x86_64-unknown-unknown -fopenmp-version=52 -DOMP52 -emit-llvm %s -o - | 
FileCheck %s --check-prefixes=CHECK,CHECK-IRBUILDER
 // RUN: %clang_cc1 -fopenmp -fopenmp-enable-irbuilder -triple 
x86_64-unknown-unknown -emit-pch -o %t %s
 // RUN: %clang_cc1 -fopenmp -fopenmp-enable-irbuilder -triple 
x86_64-unknown-unknown -include-pch %t -verify %s -emit-llvm -o - | FileCheck 
%s --check-prefixes=CHECK,CHECK-IRBUILDER
 
-// RUN: %clang_cc1 -fopenmp -fopenmp-version=52 -fopenmp-enable-irbuilder 
-triple x86_64-unknown-unknown -emit-pch -o %t %s
-// RUN: %clang_cc1 -fopenmp -fopenmp-version=52 -fopenmp-enable-irbuilder 
-triple x86_64-unknown-unknown -include-pch %t -verify %s -emit-llvm -o - | 
FileCheck %s --check-prefixes=CHECK,CHECK-IRBUILDER
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=52 -DOMP52 
-fopenmp-enable-irbuilder -triple x86_64-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=52 -DOMP52 
-fopenmp-enable-irbuilder -triple x86_64-unknown-unknown -include-pch %t 
-verify %s -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK,CHECK-IRBUILDER
 
 // RUN: %clang_cc1 -verify -fopenmp-simd -triple x86_64-unknown-unknown 
-emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s
-// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=52 -triple 
x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 
%s
+// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=52 -DOMP52 -triple 
x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 
%s
 // RUN: %clang_cc1 -fopenmp-simd -triple x86_64-unknown-unknown -emit-pch -o 
%t %s
 // RUN: %clang_cc1 -fopenmp-simd -triple x86_64-unknown-unknown -include-pch 
%t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s
-// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=52 -triple 
x86_64-unknown-unknown -emit-pch -o %t %s
-// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=52 -triple 
x86_64-unknown-unknown -include-pch %t -verify %s -emit-llvm -o - | FileCheck 
--check-prefix SIMD-ONLY0 %s
+// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=52 -DOMP52 -triple 
x86_64-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=52 -DOMP52 -triple 
x86_64-unknown-unknown -include-pch %t -verify %s -emit-llvm -o - | FileCheck 
--check-prefix SIMD-ONLY0 %s
 // SIMD-ONLY0-NOT: {{__kmpc|__tgt}}
 // expected-no-diagnostics
 
@@ -59,7 +59,7 @@
 // CHECK-NORMAL-NEXT: call void @__kmpc_doacross_post(ptr [[IDENT]], i32 
[[GTID]], ptr [[TMP]])
 // CHECK-IRBUILDER-NEXT: [[GTID1:%.+]] = call i32 
@__kmpc_global_thread_num(ptr [[IDENT:@.+]])
 

  1   2   >