[clang] [NFC] Optimize file kind determination (PR #139492)

2025-05-12 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff closed https://github.com/llvm/llvm-project/pull/139492 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC] Optimize file kind determination (PR #139492)

2025-05-11 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff updated https://github.com/llvm/llvm-project/pull/139492 >From 95522dc44fa7c807cf0278e0ce0a62bc0761ed04 Mon Sep 17 00:00:00 2001 From: Serge Pavlov Date: Fri, 9 May 2025 23:29:08 +0700 Subject: [PATCH 1/2] [NFC] Optimize File kind determination There are checks in c

[clang] [NFC] Optimize file kind determination (PR #139492)

2025-05-11 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff created https://github.com/llvm/llvm-project/pull/139492 There are checks in clang codebase that determine the type of source file, associated with a given location - specifically, if it is an ordonary file or comes from sources like command-line options or a built-

[clang] [llvm] Minimal support of floating-point operand bundles (PR #135658)

2025-05-05 Thread Serge Pavlov via cfe-commits
spavloff wrote: Thre is a separate fix for lowering in Selection DAG: https://github.com/llvm/llvm-project/pull/138553, https://github.com/llvm/llvm-project/pull/135658 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi

[clang] [Clang] Do not warn for serialized builtin or command-line definitions (PR #137306)

2025-04-30 Thread Serge Pavlov via cfe-commits
Juan Manuel Martinez =?utf-8?q?Caama=C3=B1o?= Message-ID: In-Reply-To: https://github.com/spavloff approved this pull request. LGTM, thanks! https://github.com/llvm/llvm-project/pull/137306 ___ cfe-commits mailing list cfe-commits@lists.llvm.org htt

[clang] [llvm] Minimal support of floating-point operand bundles (PR #135658)

2025-04-24 Thread Serge Pavlov via cfe-commits
spavloff wrote: > Tests for FP operand bundles on a non-intrinsic function would be helpful. This patch's operand bundles are designed specifically for use with intrinsic functions, similar to constrained intrinsics. Using operand bundles with user-supplied function would require refining sema

[clang] [llvm] Minimal support of floating-point operand bundles (PR #135658)

2025-04-20 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff updated https://github.com/llvm/llvm-project/pull/135658 >From 287340535219cd5bc31de3a27cde1b279db0eb09 Mon Sep 17 00:00:00 2001 From: Serge Pavlov Date: Mon, 14 Apr 2025 12:51:43 +0700 Subject: [PATCH 1/6] Minimal support of floating-point operand bundles This is a

[clang] [llvm] Minimal support of floating-point operand bundles (PR #135658)

2025-04-15 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff updated https://github.com/llvm/llvm-project/pull/135658 >From 287340535219cd5bc31de3a27cde1b279db0eb09 Mon Sep 17 00:00:00 2001 From: Serge Pavlov Date: Mon, 14 Apr 2025 12:51:43 +0700 Subject: [PATCH 1/2] Minimal support of floating-point operand bundles This is a

[clang] [clang] Fix array types comparison in getCommonSugaredType (PR #131649)

2025-04-05 Thread Serge Pavlov via cfe-commits
@@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -triple x86_64-linux-gnu %s + +bool a; +constexpr const unsigned char c[] = { 5 }; +constexpr const unsigned char d[1] = { 0 }; +auto b = (a ? d : c); + +constexpr const unsigned char c1[][1] = {{ 5 }}; +constexpr const unsigned char d1[1][1] =

[clang] [clang] Fix array types comparison in getCommonSugaredType (PR #131649)

2025-04-04 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff closed https://github.com/llvm/llvm-project/pull/131649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix array types comparison in getCommonSugaredType (PR #131649)

2025-03-26 Thread Serge Pavlov via cfe-commits
spavloff wrote: Fixed in https://github.com/llvm/llvm-project/pull/132559. https://github.com/llvm/llvm-project/pull/131649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] ASTContex: fix getCommonSugaredType for array types (PR #132559)

2025-03-25 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff approved this pull request. LGTM, thanks! https://github.com/llvm/llvm-project/pull/132559 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix array types comparison in getCommonSugaredType (PR #131649)

2025-03-19 Thread Serge Pavlov via cfe-commits
@@ -14171,6 +14171,15 @@ static QualType getCommonSugarTypeNode(ASTContext &Ctx, const Type *X, static auto unwrapSugar(SplitQualType &T, Qualifiers &QTotal) { SmallVector R; while (true) { +if (const auto *ATy = dyn_cast(T.Ty)) { + // C++ 9.3.3.4p3: Any type of t

[clang] [clang] Fix array types comparison in getCommonSugaredType (PR #131649)

2025-03-19 Thread Serge Pavlov via cfe-commits
@@ -14171,6 +14171,15 @@ static QualType getCommonSugarTypeNode(ASTContext &Ctx, const Type *X, static auto unwrapSugar(SplitQualType &T, Qualifiers &QTotal) { SmallVector R; while (true) { +if (const auto *ATy = dyn_cast(T.Ty)) { + // C++ 9.3.3.4p3: Any type of t

[clang] [clang] Fix array types comparison in getCommonSugaredType (PR #131649)

2025-03-19 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff updated https://github.com/llvm/llvm-project/pull/131649 >From cdf9f1a5b960d2561a7c4415313b397578de0f8b Mon Sep 17 00:00:00 2001 From: Serge Pavlov Date: Mon, 17 Mar 2025 21:33:24 +0700 Subject: [PATCH 1/2] [clang] Fix array types comparison in getCommonSugaredType

[clang] Move const qualification of array to its elements (PR #131366)

2025-03-17 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff closed https://github.com/llvm/llvm-project/pull/131366 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Move const qualification of array to its elements (PR #131366)

2025-03-17 Thread Serge Pavlov via cfe-commits
spavloff wrote: MR https://github.com/llvm/llvm-project/pull/131649 implements an alternative fix to the problem. https://github.com/llvm/llvm-project/pull/131366 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/m

[clang] [clang] Fix array types comparison in getCommonSugaredType (PR #131649)

2025-03-17 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff created https://github.com/llvm/llvm-project/pull/131649 Const-qualification of an array caused by constexpr specifier can produce QualType, where the const qualifier is set both as fast qualifier and as a qualifier of the array element type. It can result in a comp

[clang] Move const qualification of array to its elements (PR #131366)

2025-03-14 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff created https://github.com/llvm/llvm-project/pull/131366 Const-qualification of an array caused by constexpr specifier can produce QualType, where the const qualifier is set both as fast qualifier and as a qualifier of the array element type. It can result in a comp

[clang] [llvm] [IR] Don't set strictfp on irrelevant calls (PR #122735)

2025-02-04 Thread Serge Pavlov via cfe-commits
spavloff wrote: Thank you for the clarification. Let's keep the meaning of this attribute as it currently stands. The explanations raises some concern, though. OK, strictfp at call sites keeps previous property of the call even if the basic block is detached. If a block is taken from a stric

[clang] [llvm] [IR] Don't set strictfp on irrelevant calls (PR #122735)

2025-01-22 Thread Serge Pavlov via cfe-commits
spavloff wrote: > > If strict floating-point semantics are required at this call site, they are > > are required on every relevant call in this function. It means strictfp is > > a function attribute. Does anything prevents us from removal strictfp from > > all call sites? > > I think that tak

[clang] [llvm] [IR] Don't set strictfp on irrelevant calls (PR #122735)

2025-01-20 Thread Serge Pavlov via cfe-commits
spavloff wrote: > My understanding of the attribute is that it only indicates that strict > floating-point semantics are (potentially?) required at the call site. If strict floating-point semantics are required at this call site, they are are required on every relevant call in this function.

[clang] [llvm] [IR] Don't set strictfp on irrelevant calls (PR #122735)

2025-01-17 Thread Serge Pavlov via cfe-commits
spavloff wrote: Thank you for your retrospective view on `strictfp`. I didn't realize how much it is related to inlining. This use case should be carefully analyzed to refine meaning of the attribute. > Clearly intrinisics don't get inlined by the Inliner. But what if an > intrinsic gets lowe

[clang] [llvm] [IR] Don't set strictfp on irrelevant calls (PR #122735)

2025-01-14 Thread Serge Pavlov via cfe-commits
@@ -66,6 +66,12 @@ bool IntrinsicInst::mayLowerToFunctionCall(Intrinsic::ID IID) { } } +bool IntrinsicInst::canAccessFPEnvironment(LLVMContext &C, Intrinsic::ID IID) { + AttributeList Attrs = Intrinsic::getAttributes(C, IID); + MemoryEffects ME = Attrs.getMemoryEffects();

[clang] [llvm] [IR] Don't set strictfp on irrelevant calls (PR #122735)

2025-01-14 Thread Serge Pavlov via cfe-commits
@@ -66,6 +66,17 @@ bool IntrinsicInst::mayLowerToFunctionCall(Intrinsic::ID IID) { } } +bool IntrinsicInst::canAccessFPEnvironment(Intrinsic::ID IID) { + switch (IID) { +#define DAG_INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC, DAGN) \ +case Intrinsic::INTR

[clang] [llvm] [IR] Don't set strictfp on irrelevant calls (PR #122735)

2025-01-13 Thread Serge Pavlov via cfe-commits
spavloff wrote: This patch was obtained from the commit "Don't set strictfp on irrelevant calls" from #109798. https://github.com/llvm/llvm-project/pull/122735 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mail

[clang] [llvm] Reimplement constrained 'trunc' using operand bundles (PR #118253)

2024-12-16 Thread Serge Pavlov via cfe-commits
@@ -86,6 +86,43 @@ IRBuilderBase::createCallHelper(Function *Callee, ArrayRef Ops, return CI; } +CallInst *IRBuilderBase::CreateCall(FunctionType *FTy, Value *Callee, +ArrayRef Args, +ArrayRef OpBundles

[clang] [llvm] Implement operand bundles for floating-point operations (PR #109798)

2024-12-05 Thread Serge Pavlov via cfe-commits
@@ -273,29 +306,6 @@ void InstrProfCallsite::setCallee(Value *Callee) { setArgOperand(4, Callee); } -std::optional ConstrainedFPIntrinsic::getRoundingMode() const { - unsigned NumOperands = arg_size(); - Metadata *MD = nullptr; - auto *MAV = dyn_cast(getArgOperand(NumOper

[clang] [llvm] Implement operand bundles for floating-point operations (PR #109798)

2024-12-01 Thread Serge Pavlov via cfe-commits
spavloff wrote: ### Merge activity * **Dec 2, 1:35 AM EST**: The merge label 'FP Bundles' was detected. This PR will be added to the [Graphite merge queue](https://app.graphite.dev/merges?org=llvm&repo=llvm-project) once it meets the requirements. https://github.com/llvm/llvm-project/pull/1

[clang] [llvm] Implement operand bundles for floating-point operations (PR #109798)

2024-12-01 Thread Serge Pavlov via cfe-commits
spavloff wrote: PR https://github.com/llvm/llvm-project/pull/118253 demonstrates changes required to upgrade an intrinsic (`trunc` in this case) to using FP operand bundles. https://github.com/llvm/llvm-project/pull/109798 ___ cfe-commits mailing li

[clang] [llvm] Reimplement constrained 'trunc' using operand bundles (PR #118253)

2024-12-01 Thread Serge Pavlov via cfe-commits
spavloff wrote: ### Merge activity * **Dec 2, 12:55 AM EST**: The merge label 'FP Bundles' was detected. This PR will be added to the [Graphite merge queue](https://app.graphite.dev/merges?org=llvm&repo=llvm-project) once it meets the requirements. https://github.com/llvm/llvm-project/pull/

[clang] [clang] Set FPOptions at the beginning of CompoundStmt (PR #111654)

2024-11-18 Thread Serge Pavlov via cfe-commits
spavloff wrote: `FPOptions` were added to `CompoundStmt` to help code generation for `#pragma STDC FENV_ROUND`. If dynamic rounding is used, compiler should emit a code that switch it. There is no AST nodes for pragmas, so there is no a good place to emit such code. To solve this problem Compo

[clang] [clang] Set FPOptions at the beginning of CompoundStmt (PR #111654)

2024-11-11 Thread Serge Pavlov via cfe-commits
@@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -ffast-math -ffp-contract=fast -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -ffast-math -ffp-contract=fast -emit-llvm -O2 -o - %s | FileCheck %s spavloff wrote: Yes, this fact is reflected in #84648. Actually the pro

[clang] [clang] Set FPOptions at the beginning of CompoundStmt (PR #111654)

2024-11-11 Thread Serge Pavlov via cfe-commits
@@ -1684,6 +1684,15 @@ class CompoundStmt final return hasStoredFPFeatures() ? getStoredFPFeatures() : FPOptionsOverride(); } + /// Get FPOptions inside this statement. They may differ from the outer + /// options due to pragmas. + /// \param CurFPOptions FPOptions ou

[clang] [clang] Set FPOptions at the beginning of CompoundStmt (PR #111654)

2024-11-11 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff updated https://github.com/llvm/llvm-project/pull/111654 >From a47216330a0e14025ba2c29a884d6a96d472dd73 Mon Sep 17 00:00:00 2001 From: Serge Pavlov Date: Wed, 9 Oct 2024 12:55:22 +0700 Subject: [PATCH 1/2] [clang] Set FPOptions at the beginning of CompoundStmt Compo

[clang] [clang] Set FPOptions at the beginning of CompoundStmt (PR #111654)

2024-10-28 Thread Serge Pavlov via cfe-commits
spavloff wrote: Ping. https://github.com/llvm/llvm-project/pull/111654 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Implement operand bundles for floating-point operations (PR #109798)

2024-10-28 Thread Serge Pavlov via cfe-commits
spavloff wrote: > > Right, we would need to introduce new llvm.fadd etc. to carry bundles. If > > there are no bundles these could fold back to the regular instruction > > Good. The new intrinsics will be unknown to the optimization passes and thus > be "safe by default". Optimization passes

[clang] [clang] Allow `ConditionalOperator` fast-math flags to be overridden by `pragma float_control` (PR #105912)

2024-10-09 Thread Serge Pavlov via cfe-commits
spavloff wrote: I made an alternative PR, which does not need changes in ConditionalOperator: https://github.com/llvm/llvm-project/pull/111654. https://github.com/llvm/llvm-project/pull/105912 ___ cfe-commits mailing list cfe-commits@lists.llvm.org h

[clang] [clang] Set FPOptions at the beginning of CompoundStmt (PR #111654)

2024-10-09 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff created https://github.com/llvm/llvm-project/pull/111654 CompoundStmt has FPOptions, that should be set for IRBuilder when generating code if that statement. It must fix the issue #84648. >From a7f150c90c301cdd5f55cf6eb44f4e8cf77625f1 Mon Sep 17 00:00:00 2001 From:

[clang] [clang] Allow `ConditionalOperator` fast-math flags to be overridden by `pragma float_control` (PR #105912)

2024-10-08 Thread Serge Pavlov via cfe-commits
spavloff wrote: > Any instruction that returns a floating-point value can have fast-math flags > attached to it, and because we need to check the fast-math flags on input > operands, the select instruction generated by the conditional operator needs > the flags set when fast-math is enabled. T

[clang] [clang] Allow `ConditionalOperator` fast-math flags to be overridden by `pragma float_control` (PR #105912)

2024-10-07 Thread Serge Pavlov via cfe-commits
spavloff wrote: I don't think think setting FPOptions in `ConditionalOperator` is a good idea. This operator does not represent any floating-point operation so setting FP properties on it does not look reasonable. Instead, I would like to propose you using FPOptions from CompoundStmt, you cou

[clang] [llvm] Implement operand bundles for floating-point operations (PR #109798)

2024-10-07 Thread Serge Pavlov via cfe-commits
spavloff wrote: > This sounds like a rejection of safe-by-default. What do you mean by "safe-by-default"? Implementation must be correct, and produce the code that executes in accordance to standards and documentation. Any deviation from them is an error and should be fixed. Does it mean that

[clang] [llvm] Implement operand bundles for floating-point operations (PR #109798)

2024-09-27 Thread Serge Pavlov via cfe-commits
@@ -4282,6 +4282,64 @@ static void upgradeDbgIntrinsicToDbgRecord(StringRef Name, CallBase *CI) { CI->getParent()->insertDbgRecordBefore(DR, CI->getIterator()); } +static CallBase *upgradeConstrainedIntrinsicCall(CallBase *CB, Function *F, +

[clang] [llvm] Implement operand bundles for floating-point operations (PR #109798)

2024-09-27 Thread Serge Pavlov via cfe-commits
@@ -4282,6 +4282,64 @@ static void upgradeDbgIntrinsicToDbgRecord(StringRef Name, CallBase *CI) { CI->getParent()->insertDbgRecordBefore(DR, CI->getIterator()); } +static CallBase *upgradeConstrainedIntrinsicCall(CallBase *CB, Function *F, +

[clang] [llvm] Implement operand bundles for floating-point operations (PR #109798)

2024-09-27 Thread Serge Pavlov via cfe-commits
@@ -2994,6 +2994,29 @@ A "convergencectrl" operand bundle is only valid on a ``convergent`` operation. When present, the operand bundle must contain exactly one value of token type. See the :doc:`ConvergentOperations` document for details. +.. _ob_fpe: + +Floating-point Envir

[clang] [llvm] Implement operand bundles for floating-point operations (PR #109798)

2024-09-27 Thread Serge Pavlov via cfe-commits
spavloff wrote: > I don't think attaching these operand bundles to the existing set of > intrinsics is what we want to do. I'd prefer to deprecate the existing > intrinsics and define some new scheme that uses these bundles on intrinsics > that may be used in other ways. > > One of the origin

[clang] [llvm] Implement operand bundles for floating-point operations (PR #109798)

2024-09-27 Thread Serge Pavlov via cfe-commits
@@ -47,6 +47,15 @@ enum class RoundingMode : int8_t { Invalid = -1///< Denotes invalid value. }; +inline bool isValidRoundingMode(int X) { + return X >= 0 && X <= static_cast(RoundingMode::Dynamic); spavloff wrote: This is bad function name. Actually s

[clang] [llvm] Implement operand bundles for floating-point operations (PR #109798)

2024-09-27 Thread Serge Pavlov via cfe-commits
@@ -357,6 +357,9 @@ class IRBuilderBase { void setConstrainedFPCallAttr(CallBase *I) { I->addFnAttr(Attribute::StrictFP); +MemoryEffects ME = MemoryEffects::inaccessibleMemOnly(); spavloff wrote: If a constrained intrinsic like `experimental_constra

[clang] [llvm] Implement operand bundles for floating-point operations (PR #109798)

2024-09-27 Thread Serge Pavlov via cfe-commits
@@ -43,6 +43,15 @@ enum ExceptionBehavior : uint8_t { } +inline bool isValidExceptionBehavior(unsigned X) { spavloff wrote: I think this is historically, because the functionality was implemented by different people. We have "FPE.h" and "FloatingPointMode.h

[clang] [llvm] Implement operand bundles for floating-point operations (PR #109798)

2024-09-27 Thread Serge Pavlov via cfe-commits
@@ -2994,6 +2994,29 @@ A "convergencectrl" operand bundle is only valid on a ``convergent`` operation. When present, the operand bundle must contain exactly one value of token type. See the :doc:`ConvergentOperations` document for details. +.. _ob_fpe: + +Floating-point Envir

[clang] [llvm] Implement operand bundles for floating-point operations (PR #109798)

2024-09-27 Thread Serge Pavlov via cfe-commits
@@ -4282,6 +4282,64 @@ static void upgradeDbgIntrinsicToDbgRecord(StringRef Name, CallBase *CI) { CI->getParent()->insertDbgRecordBefore(DR, CI->getIterator()); } +static CallBase *upgradeConstrainedIntrinsicCall(CallBase *CB, Function *F, +

[clang] [llvm] Implement operand bundles for floating-point operations (PR #109798)

2024-09-24 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff created https://github.com/llvm/llvm-project/pull/109798 Currently floating-point operations in general form (beyond the default mode) are always represented by calls to constrained intrinsics. In addition to the side effect, they carry additional information in the

[clang] [clang] Macro for constant rounding mode (PR #92699)

2024-06-04 Thread Serge Pavlov via cfe-commits
spavloff wrote: The discussion for the proposed mechanism is open here: https://discourse.llvm.org/t/rfc-calling-functions-if-pragma-fenv-round-is-present/79372 > > This change introduces macro ROUNDING_MODE, which is a string dependent on > > the constant rounding mode > > It expands to an id

[clang] [clang] Macro for constant rounding mode (PR #92699)

2024-06-04 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff updated https://github.com/llvm/llvm-project/pull/92699 >From f8cd2539fb7f0388d7f3955f58b61b09da03bf0c Mon Sep 17 00:00:00 2001 From: Serge Pavlov Date: Sun, 19 May 2024 18:43:08 +0700 Subject: [PATCH 1/4] [clang] Macro for constant rounding mode MIME-Version: 1.0 Co

[clang] [clang] Macro for constant rounding mode (PR #92699)

2024-05-27 Thread Serge Pavlov via cfe-commits
spavloff wrote: Thanks! I will commit it in a couple of day, if no additional feedback is provided. https://github.com/llvm/llvm-project/pull/92699 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo

[clang] [clang] Macro for constant rounding mode (PR #92699)

2024-05-24 Thread Serge Pavlov via cfe-commits
@@ -965,6 +965,16 @@ void Preprocessor::Lex(Token &Result) { LastTokenWasAt = Result.is(tok::at); --LexLevel; + if (Result.is(tok::l_brace)) { +CurlyBraceLevel++; + } else if (Result.is(tok::r_brace)) { +if (!RoundingPragmas.empty() && spavloff w

[clang] [clang] Macro for constant rounding mode (PR #92699)

2024-05-24 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff updated https://github.com/llvm/llvm-project/pull/92699 >From f8cd2539fb7f0388d7f3955f58b61b09da03bf0c Mon Sep 17 00:00:00 2001 From: Serge Pavlov Date: Sun, 19 May 2024 18:43:08 +0700 Subject: [PATCH 1/3] [clang] Macro for constant rounding mode MIME-Version: 1.0 Co

[clang] [clang] Macro for constant rounding mode (PR #92699)

2024-05-23 Thread Serge Pavlov via cfe-commits
@@ -0,0 +1,55 @@ +// RUN: %clang_cc1 -emit-llvm -triple i386-linux -Wno-unknown-pragmas %s -o - | FileCheck %s spavloff wrote: Parsing pragma FENV_ROUND has been moved to the preprocessor. https://github.com/llvm/llvm-project/pull/92699

[clang] [clang] Macro for constant rounding mode (PR #92699)

2024-05-23 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff updated https://github.com/llvm/llvm-project/pull/92699 >From f8cd2539fb7f0388d7f3955f58b61b09da03bf0c Mon Sep 17 00:00:00 2001 From: Serge Pavlov Date: Sun, 19 May 2024 18:43:08 +0700 Subject: [PATCH 1/2] [clang] Macro for constant rounding mode MIME-Version: 1.0 Co

[clang] [clang] Macro for constant rounding mode (PR #92699)

2024-05-20 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff ready_for_review https://github.com/llvm/llvm-project/pull/92699 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Macro for constant rounding mode (PR #92699)

2024-05-20 Thread Serge Pavlov via cfe-commits
@@ -0,0 +1,55 @@ +// RUN: %clang_cc1 -emit-llvm -triple i386-linux -Wno-unknown-pragmas %s -o - | FileCheck %s spavloff wrote: No, this macro is managed by the code in Sema, because pragma FENV_ROUND is processed there. If only `-E` is specified, __ROUNDING_MOD

[clang] [clang] Macro for constant rounding mode (PR #92699)

2024-05-19 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff updated https://github.com/llvm/llvm-project/pull/92699 >From f8cd2539fb7f0388d7f3955f58b61b09da03bf0c Mon Sep 17 00:00:00 2001 From: Serge Pavlov Date: Sun, 19 May 2024 18:43:08 +0700 Subject: [PATCH] [clang] Macro for constant rounding mode MIME-Version: 1.0 Conten

[clang] [clang] Macro for constant rounding mode (PR #92699)

2024-05-19 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff created https://github.com/llvm/llvm-project/pull/92699 The forthcoming C standard defines pragma FENV_ROUND to support constant rounding mode. It also requires some functions to be evaluated with such mode, N3096 7.6.2p4 states: Within the scope of an FENV_ROU

[clang] [clang] Use constant rounding mode for floating literals (PR #90877)

2024-05-16 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff closed https://github.com/llvm/llvm-project/pull/90877 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Use constant rounding mode for floating literals (PR #90877)

2024-05-16 Thread Serge Pavlov via cfe-commits
spavloff wrote: > The changes should come with a release note so that users know about the > behavioral change, but otherwise LGTM. Pragma FENV_ROUND is still officially unsupported, compiler issues a warning about this. It is https://github.com/llvm/llvm-project/pull/89617 that makes FENV_RO

[clang] [clang] Use constant rounding mode for floating literals (PR #90877)

2024-05-15 Thread Serge Pavlov via cfe-commits
spavloff wrote: Are there any other comments? Can this PR be considered as approved? https://github.com/llvm/llvm-project/pull/90877 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Store FPOptions earlier when parsing function (PR #92146)

2024-05-15 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff closed https://github.com/llvm/llvm-project/pull/92146 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Store FPOptions earlier when parsing function (PR #92146)

2024-05-14 Thread Serge Pavlov via cfe-commits
@@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -emit-pch -DHEADER -x c++-header %s -o %t.pch +// RUN: %clang_cc1 -emit-llvm -include-pch %t.pch %s -o /dev/null + +#ifdef HEADER +__attribute__((optnone)) void foo() {} +#endif spavloff wrote: It is to avoid redefinition error

[clang] [clang] Store FPOptions earlier when parsing function (PR #92146)

2024-05-14 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff updated https://github.com/llvm/llvm-project/pull/92146 >From 4f6f0acb47d21b25e4e86733a81d609f4de7dc3c Mon Sep 17 00:00:00 2001 From: Serge Pavlov Date: Tue, 14 May 2024 23:11:21 +0700 Subject: [PATCH 1/2] [clang] Store FPOptions earlier when parsing function After

[clang] [clang] Set correct FPOptions if attribute 'optnone' presents (PR #85605)

2024-05-14 Thread Serge Pavlov via cfe-commits
spavloff wrote: PR https://github.com/llvm/llvm-project/pull/92146 does not solve the problem of serialization mentioned above, but it is simple and quick solution for the reported crash. https://github.com/llvm/llvm-project/pull/85605 ___ cfe-commit

[clang] [clang] Store FPOptions earlier when parsing function (PR #92146)

2024-05-14 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff created https://github.com/llvm/llvm-project/pull/92146 After https://github.com/llvm/llvm-project/pull/85605 ([clang] Set correct FPOptions if attribute 'optnone' presents) the current FP options in Sema are saved during parsing function because Sema can modify the

[clang] [clang] Set correct FPOptions if attribute 'optnone' presents (PR #85605)

2024-05-13 Thread Serge Pavlov via cfe-commits
spavloff wrote: Hi @SLTozer, Thank you for the report. There is an issue somewhere around the code that reads/wtites records FP_PRAGMA_OPTIONS and/or FLOAT_CONTROL_PRAGMA_OPTIONS, which sometimes manifest itseld in broken synchronization of FP options. I will prepare fix soon. https://github

[clang] Implementation of '#pragma STDC FENV_ROUND' (PR #89617)

2024-05-13 Thread Serge Pavlov via cfe-commits
spavloff wrote: > 7.6.2p4 does clearly state that floating constants need to be evaluated > according to the standard rounding mode, so that the constant 0.1 evaluates > to a different value in FE_DOWNWARD versus FE_UPWARD. Treatment of floating-point constants is fixed in https://github.com/

[clang] Implementation of '#pragma STDC FENV_ROUND' (PR #89617)

2024-05-13 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff edited https://github.com/llvm/llvm-project/pull/89617 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Implementation of '#pragma STDC FENV_ROUND' (PR #89617)

2024-05-13 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff updated https://github.com/llvm/llvm-project/pull/89617 >From ec8838685fb7af618445c3ff1bae953778996c37 Mon Sep 17 00:00:00 2001 From: Serge Pavlov Date: Thu, 14 Apr 2022 18:00:14 +0700 Subject: [PATCH 1/3] Implementation of '#pragma STDC FENV_ROUND' This pragma is i

[clang] [clang] Use constant rounding mode for floating literals (PR #90877)

2024-05-06 Thread Serge Pavlov via cfe-commits
@@ -79,3 +79,16 @@ float V7 = []() -> float { 0x0.01p0F); }(); // CHECK: @V7 = {{.*}} float 1.00e+00 + +template struct L { + constexpr L() : value(V) {} + float value; +}; + +#pragma STDC FENV_ROUND FE_DOWNWARD spavloff wrote: Explicit instantiati

[clang] [clang] Use constant rounding mode for floating literals (PR #90877)

2024-05-06 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff updated https://github.com/llvm/llvm-project/pull/90877 >From 5d906b537636ca0d8706a8a888dd78edfbec684f Mon Sep 17 00:00:00 2001 From: Serge Pavlov Date: Thu, 2 May 2024 22:28:05 +0700 Subject: [PATCH 01/10] [clang] Use constant rounding mode for floating literals C

[clang] [clang] Enable FPContract with optnone (PR #91061)

2024-05-06 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff closed https://github.com/llvm/llvm-project/pull/91061 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Enable FPContract with optnone (PR #91061)

2024-05-05 Thread Serge Pavlov via cfe-commits
@@ -968,10 +968,7 @@ class FPOptionsOverride { setAllowFPContractAcrossStatement(); } - void setDisallowOptimizations() { -setFPPreciseEnabled(true); -setDisallowFPContract(); - } + void setDisallowOptimizations() { setFPPreciseEnabled(true); } -

[clang] [clang] Use constant rounding mode for floating literals (PR #90877)

2024-05-04 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff updated https://github.com/llvm/llvm-project/pull/90877 >From 5d906b537636ca0d8706a8a888dd78edfbec684f Mon Sep 17 00:00:00 2001 From: Serge Pavlov Date: Thu, 2 May 2024 22:28:05 +0700 Subject: [PATCH 1/8] [clang] Use constant rounding mode for floating literals Conv

[clang] [clang] Enable FPContract with optnone (PR #91061)

2024-05-04 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff updated https://github.com/llvm/llvm-project/pull/91061 >From 32c0ec8a03b0c669dc595894730dd6f8a7933dea Mon Sep 17 00:00:00 2001 From: Serge Pavlov Date: Sat, 4 May 2024 12:26:22 +0700 Subject: [PATCH 1/2] [clang] Enable FPContract with optnone Previously treatment o

[clang] [clang] Set correct FPOptions if attribute 'optnone' presents (PR #85605)

2024-05-04 Thread Serge Pavlov via cfe-commits
spavloff wrote: Hi @wjristow, Thank you for your detailed analysis. Indeed, FPContract looks more like mandatory option rather than optional optimization. I prepared PR: https://github.com/llvm/llvm-project/pull/91061, which fixes this issue. https://github.com/llvm/llvm-project/pull/85605 __

[clang] [clang] Enable FPContract with optnone (PR #91061)

2024-05-04 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff created https://github.com/llvm/llvm-project/pull/91061 Previously treatment of the attribute `optnone` was modified in https://github.com/llvm/llvm-project/pull/85605 ([clang] Set correct FPOptions if attribute 'optnone' presents). As a side effect FPContract was d

[clang] [clang] Use constant rounding mode for floating literals (PR #90877)

2024-05-03 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff updated https://github.com/llvm/llvm-project/pull/90877 >From 5d906b537636ca0d8706a8a888dd78edfbec684f Mon Sep 17 00:00:00 2001 From: Serge Pavlov Date: Thu, 2 May 2024 22:28:05 +0700 Subject: [PATCH 1/7] [clang] Use constant rounding mode for floating literals Conv

[clang] [clang] Use constant rounding mode for floating literals (PR #90877)

2024-05-03 Thread Serge Pavlov via cfe-commits
@@ -79,3 +79,16 @@ float V7 = []() -> float { 0x0.01p0F); }(); // CHECK: @V7 = {{.*}} float 1.00e+00 + +template struct L { + constexpr L() : value(V) {} + float value; +}; + +#pragma STDC FENV_ROUND FE_DOWNWARD spavloff wrote: > Does the FENV_ROUN

[clang] [clang] Use constant rounding mode for floating literals (PR #90877)

2024-05-03 Thread Serge Pavlov via cfe-commits
@@ -79,3 +79,16 @@ float V7 = []() -> float { 0x0.01p0F); }(); // CHECK: @V7 = {{.*}} float 1.00e+00 + +template struct L { + constexpr L() : value(V) {} + float value; +}; + +#pragma STDC FENV_ROUND FE_DOWNWARD spavloff wrote: In this snippet `Val

[clang] [clang] Use constant rounding mode for floating literals (PR #90877)

2024-05-03 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff updated https://github.com/llvm/llvm-project/pull/90877 >From 5d906b537636ca0d8706a8a888dd78edfbec684f Mon Sep 17 00:00:00 2001 From: Serge Pavlov Date: Thu, 2 May 2024 22:28:05 +0700 Subject: [PATCH 1/5] [clang] Use constant rounding mode for floating literals Conv

[clang] [clang] Use constant rounding mode for floating literals (PR #90877)

2024-05-03 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff updated https://github.com/llvm/llvm-project/pull/90877 >From 5d906b537636ca0d8706a8a888dd78edfbec684f Mon Sep 17 00:00:00 2001 From: Serge Pavlov Date: Thu, 2 May 2024 22:28:05 +0700 Subject: [PATCH 1/4] [clang] Use constant rounding mode for floating literals Conv

[clang] [clang] Use constant rounding mode for floating literals (PR #90877)

2024-05-02 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff updated https://github.com/llvm/llvm-project/pull/90877 >From 5d906b537636ca0d8706a8a888dd78edfbec684f Mon Sep 17 00:00:00 2001 From: Serge Pavlov Date: Thu, 2 May 2024 22:28:05 +0700 Subject: [PATCH 1/2] [clang] Use constant rounding mode for floating literals Conv

[clang] [clang] Use constant rounding mode for floating literals (PR #90877)

2024-05-02 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff created https://github.com/llvm/llvm-project/pull/90877 Conversion of floating-point literal to binary representation must be made using constant rounding mode, which can be changed using pragma FENV_ROUND. For example, the literal "0.1F" should be representes by ei

[clang] [clang] Set correct FPOptions if attribute 'optnone' presents (PR #85605)

2024-04-25 Thread Serge Pavlov via cfe-commits
spavloff wrote: Hi @dyung. The observed difference is due to the FP contraction turned off if optnone is specified. In O0 this optimization is still applied. As a result, the function with optnone contains separate fadd and fmul, while without this attribute the function contains combined ope

[clang] Implementation of '#pragma STDC FENV_ROUND' (PR #89617)

2024-04-25 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff updated https://github.com/llvm/llvm-project/pull/89617 >From 0fc5c57264ecf51f8b9fe8303520a51cb1fee40e Mon Sep 17 00:00:00 2001 From: Serge Pavlov Date: Thu, 14 Apr 2022 18:00:14 +0700 Subject: [PATCH 1/2] Implementation of '#pragma STDC FENV_ROUND' This pragma is i

[clang] Implementation of '#pragma STDC FENV_ROUND' (PR #89617)

2024-04-23 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff updated https://github.com/llvm/llvm-project/pull/89617 >From 0fc5c57264ecf51f8b9fe8303520a51cb1fee40e Mon Sep 17 00:00:00 2001 From: Serge Pavlov Date: Thu, 14 Apr 2022 18:00:14 +0700 Subject: [PATCH] Implementation of '#pragma STDC FENV_ROUND' This pragma is intro

[clang] [clang] Set correct FPOptions if attribute 'optnone' presents (PR #85605)

2024-04-23 Thread Serge Pavlov via cfe-commits
spavloff wrote: Thanks! > Is there any existing bookkeeping we no longer need to do if we're going to > have this RAII object in scope during function parsing? It seems handling fast-math is the only case that prevented using this RAII object. https://github.com/llvm/llvm-project/pull/85605

[clang] [clang] Set correct FPOptions if attribute 'optnone' presents (PR #85605)

2024-04-23 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff closed https://github.com/llvm/llvm-project/pull/85605 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Implementation of '#pragma STDC FENV_ROUND' (PR #89617)

2024-04-22 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff updated https://github.com/llvm/llvm-project/pull/89617 >From fc7aab600c25b39b2df039c0cbcf517719736311 Mon Sep 17 00:00:00 2001 From: Serge Pavlov Date: Thu, 14 Apr 2022 18:00:14 +0700 Subject: [PATCH] Implementation of '#pragma STDC FENV_ROUND' This pragma is intro

[clang] Implementation of '#pragma STDC FENV_ROUND' (PR #89617)

2024-04-22 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff created https://github.com/llvm/llvm-project/pull/89617 This pragma is introduced by forthcoming C2x standard and can be used to set particular rounding mode without need to call 'fesetmode' or accessing control mode registers directly. Previously this pragma was im

[clang] [clang] Set correct FPOptions if attribute 'optnone' presents (PR #85605)

2024-04-22 Thread Serge Pavlov via cfe-commits
spavloff wrote: A little about the significance of this fix. To implement pragma FENV_ROUND, we need to apply the FP options stored in the instance of CompoundStmt to the builder object, so that it uses the specified rounding mode. It can be done using the class CGFPOptionsRAII. However in thi

[clang] [clang] Set correct FPOptions if attribute 'optnone' presents (PR #85605)

2024-04-15 Thread Serge Pavlov via cfe-commits
spavloff wrote: Ping. https://github.com/llvm/llvm-project/pull/85605 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Set correct FPOptions if attribute 'optnone' presents (PR #85605)

2024-04-15 Thread Serge Pavlov via cfe-commits
https://github.com/spavloff updated https://github.com/llvm/llvm-project/pull/85605 >From 07e171e0566ab584299a57c210106bb8220c6261 Mon Sep 17 00:00:00 2001 From: Serge Pavlov Date: Mon, 18 Mar 2024 13:20:15 +0700 Subject: [PATCH 1/4] [clang] Set correct FPOptions if attribute 'optnone' present

  1   2   3   4   5   >