Skip to content

Conversation

@4vtomat
Copy link
Member

@4vtomat 4vtomat commented Dec 12, 2025

RISC-V vector intrinsic is generated dynamically at runtime, thus it's
note preserved in AST yet when using precompile header, neither do
information in SemaRISCV. We need to write these information to ast
record to be able to use precompile header for RISC-V.

Fixes #109634

RISC-V vector intrinsic is generated dynamically at runtime, thus it's
note preserved in AST yet when using precompile header, neither do
information in SemaRISCV. We need to write these information to ast
record to be able to use precompile header for RISC-V.

Fixes llvm#109634
@llvmbot llvmbot added clang Clang issues not falling into any other category backend:RISC-V clang:frontend Language frontend issues, e.g. anything involving "Sema" clang:modules C++20 modules and Clang Header Modules labels Dec 12, 2025
@llvmbot
Copy link
Member

llvmbot commented Dec 12, 2025

@llvm/pr-subscribers-clang
@llvm/pr-subscribers-clang-modules

@llvm/pr-subscribers-backend-risc-v

Author: Brandon Wu (4vtomat)

Changes

RISC-V vector intrinsic is generated dynamically at runtime, thus it's
note preserved in AST yet when using precompile header, neither do
information in SemaRISCV. We need to write these information to ast
record to be able to use precompile header for RISC-V.

Fixes #109634


Full diff: https://github.com/llvm/llvm-project/pull/171981.diff

7 Files Affected:

  • (modified) clang/include/clang/Sema/Sema.h (+1)
  • (modified) clang/include/clang/Serialization/ASTBitCodes.h (+3)
  • (modified) clang/include/clang/Serialization/ASTReader.h (+3)
  • (modified) clang/include/clang/Serialization/ASTWriter.h (+1)
  • (modified) clang/lib/Serialization/ASTReader.cpp (+14)
  • (modified) clang/lib/Serialization/ASTWriter.cpp (+11)
  • (added) clang/test/PCH/riscv-rvv-vectors.c (+14)
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 97b6bb3d1b3a8..9025fa2e0db92 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -66,6 +66,7 @@
 #include "clang/Sema/Scope.h"
 #include "clang/Sema/SemaBase.h"
 #include "clang/Sema/SemaConcept.h"
+#include "clang/Sema/SemaRISCV.h"
 #include "clang/Sema/TypoCorrection.h"
 #include "clang/Sema/Weak.h"
 #include "llvm/ADT/APInt.h"
diff --git a/clang/include/clang/Serialization/ASTBitCodes.h b/clang/include/clang/Serialization/ASTBitCodes.h
index b48f02c601889..5a86d540e5d0b 100644
--- a/clang/include/clang/Serialization/ASTBitCodes.h
+++ b/clang/include/clang/Serialization/ASTBitCodes.h
@@ -745,6 +745,9 @@ enum ASTRecordTypes {
   UPDATE_MODULE_LOCAL_VISIBLE = 76,
 
   UPDATE_TU_LOCAL_VISIBLE = 77,
+
+  /// Record code for #pragma clang riscv intrinsic vector.
+  RISCV_VECTOR_INTRINSICS_PRAGMA = 78,
 };
 
 /// Record types used within a source manager block.
diff --git a/clang/include/clang/Serialization/ASTReader.h b/clang/include/clang/Serialization/ASTReader.h
index d276f0d21b958..63f0fde60bb16 100644
--- a/clang/include/clang/Serialization/ASTReader.h
+++ b/clang/include/clang/Serialization/ASTReader.h
@@ -1079,6 +1079,9 @@ class ASTReader
   /// The IDs of all decls with function effects to be checked.
   SmallVector<GlobalDeclID> DeclsWithEffectsToVerify;
 
+  /// The RISC-V intrinsic pragma(including RVV, SiFive and Andes).
+  SmallVector<bool, 3> RISCVVecIntrinsicPragma;
+
 private:
   struct ImportedSubmodule {
     serialization::SubmoduleID ID;
diff --git a/clang/include/clang/Serialization/ASTWriter.h b/clang/include/clang/Serialization/ASTWriter.h
index c77c98dffc39f..634944fa76c19 100644
--- a/clang/include/clang/Serialization/ASTWriter.h
+++ b/clang/include/clang/Serialization/ASTWriter.h
@@ -640,6 +640,7 @@ class ASTWriter : public ASTDeserializationListener,
   void WriteDeclsWithEffectsToVerify(Sema &SemaRef);
   void WriteModuleFileExtension(Sema &SemaRef,
                                 ModuleFileExtensionWriter &Writer);
+  void WriteRISCVIntrinsicPragmas(Sema &SemaRef);
 
   unsigned DeclParmVarAbbrev = 0;
   unsigned DeclContextLexicalAbbrev = 0;
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index aec61322fb8be..bbf14b6e359a0 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -4447,6 +4447,17 @@ llvm::Error ASTReader::ReadASTBlock(ModuleFile &F,
       for (unsigned I = 0, N = Record.size(); I != N; /*in loop*/)
         DeclsToCheckForDeferredDiags.insert(ReadDeclID(F, Record, I));
       break;
+
+    case RISCV_VECTOR_INTRINSICS_PRAGMA: {
+      unsigned NumRecords = Record.back();
+      // Last record which is used to keep number of valid records.
+      if (Record.size() - 1 != NumRecords)
+        return llvm::createStringError(std::errc::illegal_byte_sequence,
+                                       "invalid rvv intrinsic pragma record");
+      for (unsigned i = 0; i < NumRecords; ++i)
+        RISCVVecIntrinsicPragma.push_back(Record[i]);
+      break;
+    }
     }
   }
 }
@@ -9063,6 +9074,9 @@ void ASTReader::UpdateSema() {
         PointersToMembersPragmaLocation);
   }
   SemaObj->CUDA().ForceHostDeviceDepth = ForceHostDeviceDepth;
+  SemaObj->RISCV().DeclareRVVBuiltins = RISCVVecIntrinsicPragma[0];
+  SemaObj->RISCV().DeclareSiFiveVectorBuiltins = RISCVVecIntrinsicPragma[1];
+  SemaObj->RISCV().DeclareAndesVectorBuiltins = RISCVVecIntrinsicPragma[2];
 
   if (PragmaAlignPackCurrentValue) {
     // The bottom of the stack might have a default value. It must be adjusted
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index 667e04049dac8..699e45dc08c06 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -972,6 +972,7 @@ void ASTWriter::WriteBlockInfoBlock() {
   RECORD(PP_ASSUME_NONNULL_LOC);
   RECORD(PP_UNSAFE_BUFFER_USAGE);
   RECORD(VTABLES_TO_EMIT);
+  RECORD(RISCV_VECTOR_INTRINSICS_PRAGMA);
 
   // SourceManager Block.
   BLOCK(SOURCE_MANAGER_BLOCK);
@@ -5232,6 +5233,15 @@ void ASTWriter::WriteModuleFileExtension(Sema &SemaRef,
   Stream.ExitBlock();
 }
 
+void ASTWriter::WriteRISCVIntrinsicPragmas(Sema &SemaRef) {
+  RecordData Record;
+  Record.push_back(SemaRef.RISCV().DeclareRVVBuiltins);
+  Record.push_back(SemaRef.RISCV().DeclareSiFiveVectorBuiltins);
+  Record.push_back(SemaRef.RISCV().DeclareAndesVectorBuiltins);
+  Record.push_back(Record.size());
+  Stream.EmitRecord(RISCV_VECTOR_INTRINSICS_PRAGMA, Record);
+}
+
 //===----------------------------------------------------------------------===//
 // General Serialization Routines
 //===----------------------------------------------------------------------===//
@@ -6130,6 +6140,7 @@ ASTFileSignature ASTWriter::WriteASTCore(Sema *SemaPtr, StringRef isysroot,
     WriteFPPragmaOptions(SemaPtr->CurFPFeatureOverrides());
     WriteOpenCLExtensions(*SemaPtr);
     WriteCUDAPragmas(*SemaPtr);
+    WriteRISCVIntrinsicPragmas(*SemaPtr);
   }
 
   // If we're emitting a module, write out the submodule information.
diff --git a/clang/test/PCH/riscv-rvv-vectors.c b/clang/test/PCH/riscv-rvv-vectors.c
new file mode 100644
index 0000000000000..30f058753c747
--- /dev/null
+++ b/clang/test/PCH/riscv-rvv-vectors.c
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -triple riscv64-linux-gnu -target-feature +v -emit-pch -o %t %s
+// RUN: %clang_cc1 -triple riscv64-linux-gnu -target-feature +v -include-pch %t \
+// RUN:   -fsyntax-only -verify %s
+
+// expected-no-diagnostics
+
+#ifndef HEADER
+#define HEADER
+#include <riscv_vector.h>
+#else
+vuint64m4_t v_add(vuint64m4_t a, vuint64m4_t b, size_t vl) {
+    return __riscv_vadd_vv_u64m4(a, b, vl);
+}
+#endif

Record.push_back(SemaRef.RISCV().DeclareRVVBuiltins);
Record.push_back(SemaRef.RISCV().DeclareSiFiveVectorBuiltins);
Record.push_back(SemaRef.RISCV().DeclareAndesVectorBuiltins);
Record.push_back(Record.size());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the size pushed last? Why not first?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking it has less complexity than insert to front. However I think we can just hard code it since we have to update this file anyway when we have new intrinsic class to update lol

@github-actions
Copy link

github-actions bot commented Dec 13, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@github-actions
Copy link

github-actions bot commented Dec 13, 2025

🐧 Linux x64 Test Results

  • 112102 tests passed
  • 4520 tests skipped

✅ The build succeeded and all tests passed.

Copy link
Collaborator

@topperc topperc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@4vtomat 4vtomat merged commit fe577b1 into llvm:main Dec 17, 2025
10 checks passed
@4vtomat 4vtomat deleted the rvv_intrinsic_pch branch December 17, 2025 04:54
@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 17, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-x86_64-sie-ubuntu-fast running on sie-linux-worker while building clang at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/144/builds/42454

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'Clang :: PCH/riscv-rvv-vectors.c' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
rm -rf /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp
# executed command: rm -rf /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp
# note: command had no output on stdout or stderr
# RUN: at line 2
split-file /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/test/PCH/riscv-rvv-vectors.c /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp
# executed command: split-file /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/test/PCH/riscv-rvv-vectors.c /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp
# note: command had no output on stdout or stderr
# RUN: at line 6
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/clang -cc1 -internal-isystem /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/lib/clang/22/include -nostdsysteminc -triple riscv64-linux-gnu -target-feature +v -emit-pch -o /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp/test_pch.pch /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp/test_pch.h
# executed command: /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/clang -cc1 -internal-isystem /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/lib/clang/22/include -nostdsysteminc -triple riscv64-linux-gnu -target-feature +v -emit-pch -o /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp/test_pch.pch /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp/test_pch.h
# .---command stderr------------
# | /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp/test_pch.h:2:10: fatal error: 'riscv_vector.h' file not found
# |     2 | #include <riscv_vector.h>
# |       |          ^~~~~~~~~~~~~~~~
# | 1 error generated.
# `-----------------------------
# error: command failed with exit status: 1

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 17, 2025

LLVM Buildbot has detected a new failure on builder clang-aarch64-quick running on linaro-clang-aarch64-quick while building clang at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/65/builds/27041

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'Clang :: PCH/riscv-rvv-vectors.c' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
rm -rf /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp
# executed command: rm -rf /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp
# RUN: at line 2
split-file /home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/test/PCH/riscv-rvv-vectors.c /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp
# executed command: split-file /home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/clang/test/PCH/riscv-rvv-vectors.c /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp
# RUN: at line 6
/home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/bin/clang -cc1 -internal-isystem /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/lib/clang/22/include -nostdsysteminc -triple riscv64-linux-gnu -target-feature +v -emit-pch -o /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp/test_pch.pch /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp/test_pch.h
# executed command: /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/bin/clang -cc1 -internal-isystem /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/lib/clang/22/include -nostdsysteminc -triple riscv64-linux-gnu -target-feature +v -emit-pch -o /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp/test_pch.pch /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp/test_pch.h
# .---command stderr------------
# | /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp/test_pch.h:2:10: fatal error: 'riscv_vector.h' file not found
# |     2 | #include <riscv_vector.h>
# |       |          ^~~~~~~~~~~~~~~~
# | 1 error generated.
# `-----------------------------
# error: command failed with exit status: 1

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 17, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-aarch64-darwin running on doug-worker-4 while building clang at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/190/builds/32917

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'Clang :: PCH/riscv-rvv-vectors.c' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
rm -rf /Volumes/RAMDisk/buildbot-root/aarch64-darwin/build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp
# executed command: rm -rf /Volumes/RAMDisk/buildbot-root/aarch64-darwin/build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp
# note: command had no output on stdout or stderr
# RUN: at line 2
split-file /Users/buildbot/buildbot-root/llvm-project/clang/test/PCH/riscv-rvv-vectors.c /Volumes/RAMDisk/buildbot-root/aarch64-darwin/build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp
# executed command: split-file /Users/buildbot/buildbot-root/llvm-project/clang/test/PCH/riscv-rvv-vectors.c /Volumes/RAMDisk/buildbot-root/aarch64-darwin/build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp
# note: command had no output on stdout or stderr
# RUN: at line 6
/Volumes/RAMDisk/buildbot-root/aarch64-darwin/build/bin/clang -cc1 -internal-isystem /Volumes/RAMDisk/buildbot-root/aarch64-darwin/build/lib/clang/22/include -nostdsysteminc -triple riscv64-linux-gnu -target-feature +v -emit-pch -o /Volumes/RAMDisk/buildbot-root/aarch64-darwin/build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp/test_pch.pch /Volumes/RAMDisk/buildbot-root/aarch64-darwin/build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp/test_pch.h
# executed command: /Volumes/RAMDisk/buildbot-root/aarch64-darwin/build/bin/clang -cc1 -internal-isystem /Volumes/RAMDisk/buildbot-root/aarch64-darwin/build/lib/clang/22/include -nostdsysteminc -triple riscv64-linux-gnu -target-feature +v -emit-pch -o /Volumes/RAMDisk/buildbot-root/aarch64-darwin/build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp/test_pch.pch /Volumes/RAMDisk/buildbot-root/aarch64-darwin/build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp/test_pch.h
# .---command stderr------------
# | /Volumes/RAMDisk/buildbot-root/aarch64-darwin/build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp/test_pch.h:2:10: fatal error: 'riscv_vector.h' file not found
# |     2 | #include <riscv_vector.h>
# |       |          ^~~~~~~~~~~~~~~~
# | 1 error generated.
# `-----------------------------
# error: command failed with exit status: 1

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 17, 2025

LLVM Buildbot has detected a new failure on builder clang-m68k-linux-cross running on suse-gary-m68k-cross while building clang at step 4 "build stage 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/27/builds/20426

Here is the relevant piece of the build log for the reference
Step 4 (build stage 1) failure: 'ninja' (failure)
...
  442 |       SemaRef.CurrentInstantiationScope = this;
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/lib/Sema/SemaTemplate.cpp: In member function ‘bool clang::Sema::CheckTemplateArgumentList(clang::TemplateDecl*, clang::TemplateParameterList*, clang::SourceLocation, clang::TemplateArgumentListInfo&, const clang::DefaultArguments&, bool, CheckTemplateArgumentInfo&, bool, bool*)’:
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/lib/Sema/SemaTemplate.cpp:5867:27: note: ‘InstScope’ declared here
 5867 |   LocalInstantiationScope InstScope(*this, true);
      |                           ^~~~~~~~~
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/lib/Sema/SemaTemplate.cpp:5846:34: note: ‘this’ declared here
 5846 |     bool *ConstraintsNotSatisfied) {
      |                                  ^
[150/451] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaOpenMP.cpp.o
FAILED: tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaOpenMP.cpp.o 
/usr/bin/c++ -DCLANG_EXPORTS -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_USE_CXX11_ABI=1 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/tools/clang/lib/Sema -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/lib/Sema -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/include -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/tools/clang/include -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/include -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-dangling-reference -Wno-redundant-move -Wno-pessimizing-move -Wno-array-bounds -Wno-stringop-overread -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -O3 -DNDEBUG -std=c++17  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -MD -MT tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaOpenMP.cpp.o -MF tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaOpenMP.cpp.o.d -o tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaOpenMP.cpp.o -c /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/lib/Sema/SemaOpenMP.cpp
In file included from /usr/include/c++/14/cassert:44,
                 from /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/include/llvm/ADT/PointerEmbeddedInt.h:15,
                 from /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/lib/Sema/SemaOpenMP.cpp:41:
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/lib/Sema/SemaOpenMP.cpp: In member function ‘clang::OMPClause* clang::SemaOpenMP::ActOnOpenMPUseDeviceAddrClause(llvm::ArrayRef<clang::Expr*>, const clang::OMPVarListLocTy&)’:
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/lib/Sema/SemaOpenMP.cpp:24751:27: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
24751 |            CurDeclaration &&
      |            ~~~~~~~~~~~~~~~^~
24752 |                "Unexpected null decl for use_device_addr clause.");
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/include/llvm/ADT/APFloat.h:18,
                 from /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/include/clang/AST/APNumericStorage.h:12,
                 from /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/include/clang/AST/Decl.h:16,
                 from /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/include/clang/AST/Attr.h:18,
                 from /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/include/clang/Sema/SemaOpenMP.h:18,
                 from /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/lib/Sema/SemaOpenMP.cpp:14:
In destructor ‘llvm::APInt::~APInt()’,
    inlined from ‘llvm::APSInt::~APSInt()’ at /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/include/llvm/ADT/APSInt.h:24:21,
    inlined from ‘bool checkOMPArraySectionConstantForReduction(clang::ASTContext&, const clang::ArraySectionExpr*, bool&, llvm::SmallVectorImpl<llvm::APSInt>&)’ at /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/clang/lib/Sema/SemaOpenMP.cpp:19960:43:
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/include/llvm/ADT/APInt.h:193:18: warning: ‘void operator delete [](void*)’ called on a pointer to an unallocated object ‘1’ [-Wfree-nonheap-object]
  193 |       delete[] U.pVal;
      |                  ^~~~
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
[151/451] Building CXX object tools/clang/lib/FrontendTool/CMakeFiles/obj.clangFrontendTool.dir/ExecuteCompilerInvocation.cpp.o
[152/451] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CIndexDiagnostic.cpp.o
[153/451] Building CXX object tools/clang/lib/Serialization/CMakeFiles/obj.clangSerialization.dir/ASTWriter.cpp.o
[154/451] Building CXX object lib/LTO/CMakeFiles/LLVMLTO.dir/LTO.cpp.o
[155/451] Building CXX object tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/LinkInModulesPass.cpp.o
[156/451] Building CXX object tools/clang/tools/extra/clang-doc/support/CMakeFiles/obj.clangDocSupport.dir/Utils.cpp.o
[157/451] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CIndexCodeCompletion.cpp.o
[158/451] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CIndexInclusionStack.cpp.o
[159/451] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CXComment.cpp.o
[160/451] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CXCursor.cpp.o
[161/451] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CIndexUSRs.cpp.o
[162/451] Building CXX object tools/clang/tools/extra/clang-tidy/CMakeFiles/obj.clangTidy.dir/ClangTidy.cpp.o
[163/451] Building CXX object lib/CodeGen/AsmPrinter/CMakeFiles/LLVMAsmPrinter.dir/AsmPrinter.cpp.o
[164/451] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CXStoredDiagnostic.cpp.o

@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 17, 2025

LLVM Buildbot has detected a new failure on builder openmp-offload-amdgpu-runtime-2 running on rocm-worker-hw-02 while building clang at step 7 "Add check check-clang".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/10/builds/19216

Here is the relevant piece of the build log for the reference
Step 7 (Add check check-clang) failure: test (failure)
******************** TEST 'Clang :: PCH/riscv-rvv-vectors.c' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
rm -rf /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp
# executed command: rm -rf /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp
# note: command had no output on stdout or stderr
# RUN: at line 2
split-file /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/clang/test/PCH/riscv-rvv-vectors.c /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp
# executed command: split-file /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/clang/test/PCH/riscv-rvv-vectors.c /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp
# note: command had no output on stdout or stderr
# RUN: at line 6
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/bin/clang -cc1 -internal-isystem /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/lib/clang/22/include -nostdsysteminc -triple riscv64-linux-gnu -target-feature +v -emit-pch -o /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp/test_pch.pch /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp/test_pch.h
# executed command: /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/bin/clang -cc1 -internal-isystem /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/lib/clang/22/include -nostdsysteminc -triple riscv64-linux-gnu -target-feature +v -emit-pch -o /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp/test_pch.pch /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp/test_pch.h
# .---command stderr------------
# | /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp/test_pch.h:2:10: fatal error: 'riscv_vector.h' file not found
# |     2 | #include <riscv_vector.h>
# |       |          ^~~~~~~~~~~~~~~~
# | 1 error generated.
# `-----------------------------
# error: command failed with exit status: 1

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 17, 2025

LLVM Buildbot has detected a new failure on builder arc-builder running on arc-worker while building clang at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/3/builds/26337

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'Clang :: PCH/riscv-rvv-vectors.c' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
rm -rf /buildbot/worker/arc-folder/build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp
# executed command: rm -rf /buildbot/worker/arc-folder/build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp
# RUN: at line 2
split-file /buildbot/worker/arc-folder/llvm-project/clang/test/PCH/riscv-rvv-vectors.c /buildbot/worker/arc-folder/build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp
# executed command: split-file /buildbot/worker/arc-folder/llvm-project/clang/test/PCH/riscv-rvv-vectors.c /buildbot/worker/arc-folder/build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp
# RUN: at line 6
/buildbot/worker/arc-folder/build/bin/clang -cc1 -internal-isystem /buildbot/worker/arc-folder/build/lib/clang/22/include -nostdsysteminc -triple riscv64-linux-gnu -target-feature +v -emit-pch -o /buildbot/worker/arc-folder/build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp/test_pch.pch /buildbot/worker/arc-folder/build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp/test_pch.h
# executed command: /buildbot/worker/arc-folder/build/bin/clang -cc1 -internal-isystem /buildbot/worker/arc-folder/build/lib/clang/22/include -nostdsysteminc -triple riscv64-linux-gnu -target-feature +v -emit-pch -o /buildbot/worker/arc-folder/build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp/test_pch.pch /buildbot/worker/arc-folder/build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp/test_pch.h
# .---command stderr------------
# | /buildbot/worker/arc-folder/build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp/test_pch.h:2:10: fatal error: 'riscv_vector.h' file not found
# |     2 | #include <riscv_vector.h>
# |       |          ^~~~~~~~~~~~~~~~
# | 1 error generated.
# `-----------------------------
# error: command failed with exit status: 1

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 17, 2025

LLVM Buildbot has detected a new failure on builder openmp-offload-sles-build-only running on rocm-worker-hw-04-sles while building clang at step 6 "Add check check-clang".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/140/builds/35801

Here is the relevant piece of the build log for the reference
Step 6 (Add check check-clang) failure: test (failure)
******************** TEST 'Clang :: PCH/riscv-rvv-vectors.c' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
rm -rf /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp
# executed command: rm -rf /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp
# RUN: at line 2
split-file /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/clang/test/PCH/riscv-rvv-vectors.c /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp
# executed command: split-file /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/clang/test/PCH/riscv-rvv-vectors.c /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp
# RUN: at line 6
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/clang -cc1 -internal-isystem /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/clang/22/include -nostdsysteminc -triple riscv64-linux-gnu -target-feature +v -emit-pch -o /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp/test_pch.pch /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp/test_pch.h
# executed command: /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/clang -cc1 -internal-isystem /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/lib/clang/22/include -nostdsysteminc -triple riscv64-linux-gnu -target-feature +v -emit-pch -o /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp/test_pch.pch /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp/test_pch.h
# .---command stderr------------
# | /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/tools/clang/test/PCH/Output/riscv-rvv-vectors.c.tmp/test_pch.h:2:10: fatal error: 'riscv_vector.h' file not found
# |     2 | #include <riscv_vector.h>
# |       |          ^~~~~~~~~~~~~~~~
# | 1 error generated.
# `-----------------------------
# error: command failed with exit status: 1

--

********************


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend:RISC-V clang:frontend Language frontend issues, e.g. anything involving "Sema" clang:modules C++20 modules and Clang Header Modules clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[clang] Can't compile RISC-V vector intrisics with precompiled headers (PCH)

4 participants