Skip to content

Conversation

@MacDue
Copy link
Member

@MacDue MacDue commented Jul 28, 2025

This is handled by the instcombine added in #147930; there is no need for any clang-specific folding. NFC as all clang tests for __arm_in_streaming_mode() used -O1, which applies the LLVM instcombines.

This is handled by the instcombine added in llvm#147930; there is no need
for any clang-specific folding. NFC as all clang tests for
`__arm_in_streaming_mode()` used -O1, which applies the LLVM
instcombines.
@MacDue MacDue requested a review from efriedma-quic July 28, 2025 10:09
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:codegen IR generation bugs: mangling, exceptions, etc. labels Jul 28, 2025
@llvmbot
Copy link
Member

llvmbot commented Jul 28, 2025

@llvm/pr-subscribers-clang

@llvm/pr-subscribers-clang-codegen

Author: Benjamin Maxwell (MacDue)

Changes

This is handled by the instcombine added in #147930; there is no need for any clang-specific folding. NFC as all clang tests for __arm_in_streaming_mode() used -O1, which applies the LLVM instcombines.


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

1 Files Affected:

  • (modified) clang/lib/CodeGen/TargetBuiltins/ARM.cpp (-13)
diff --git a/clang/lib/CodeGen/TargetBuiltins/ARM.cpp b/clang/lib/CodeGen/TargetBuiltins/ARM.cpp
index 2e6b4b3eb10f1..980f7eb714bbf 100644
--- a/clang/lib/CodeGen/TargetBuiltins/ARM.cpp
+++ b/clang/lib/CodeGen/TargetBuiltins/ARM.cpp
@@ -4922,19 +4922,6 @@ Value *CodeGenFunction::EmitAArch64SMEBuiltinExpr(unsigned BuiltinID,
   if (Builtin->LLVMIntrinsic == 0)
     return nullptr;
 
-  if (BuiltinID == SME::BI__builtin_sme___arm_in_streaming_mode) {
-    // If we already know the streaming mode, don't bother with the intrinsic
-    // and emit a constant instead
-    const auto *FD = cast<FunctionDecl>(CurFuncDecl);
-    if (const auto *FPT = FD->getType()->getAs<FunctionProtoType>()) {
-      unsigned SMEAttrs = FPT->getAArch64SMEAttributes();
-      if (!(SMEAttrs & FunctionType::SME_PStateSMCompatibleMask)) {
-        bool IsStreaming = SMEAttrs & FunctionType::SME_PStateSMEnabledMask;
-        return ConstantInt::getBool(Builder.getContext(), IsStreaming);
-      }
-    }
-  }
-
   // Predicates must match the main datatype.
   for (Value *&Op : Ops)
     if (auto PredTy = dyn_cast<llvm::VectorType>(Op->getType()))

@MacDue MacDue requested a review from gbossu July 29, 2025 08:36
Copy link
Contributor

@gbossu gbossu left a comment

Choose a reason for hiding this comment

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

I've looked at the existing clang and InstCombine tests; the change looks good to me.

@MacDue MacDue merged commit af44d87 into llvm:main Jul 29, 2025
12 checks passed
@MacDue MacDue deleted the clang_sme_nfc branch July 29, 2025 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:codegen IR generation bugs: mangling, exceptions, etc. clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants