[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-17 Thread Zahira Ammarguellat via cfe-commits
https://github.com/zahiraam closed https://github.com/llvm/llvm-project/pull/107397 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-17 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM! https://github.com/llvm/llvm-project/pull/107397 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-17 Thread Joshua Cranmer via cfe-commits
https://github.com/jcranmer-intel approved this pull request. https://github.com/llvm/llvm-project/pull/107397 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-17 Thread Zahira Ammarguellat via cfe-commits
https://github.com/zahiraam updated https://github.com/llvm/llvm-project/pull/107397 >From 621578de568be1e71665254060956ea1971965c9 Mon Sep 17 00:00:00 2001 From: Zahira Ammarguellat Date: Thu, 5 Sep 2024 05:42:26 -0700 Subject: [PATCH 1/9] [NFC] Move warning from COdeGen to Sema. --- clang/i

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-17 Thread Joshua Cranmer via cfe-commits
@@ -780,6 +780,25 @@ class ASTContext : public RefCountedBase { const TargetInfo &getTargetInfo() const { return *Target; } const TargetInfo *getAuxTargetInfo() const { return AuxTarget; } + const QualType GetHigherPrecisionFPType(QualType ElementType) const { +const

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-17 Thread Joshua Cranmer via cfe-commits
@@ -6784,6 +6784,12 @@ def warn_arc_lifetime_result_type : Warning< "ARC %select{unused|__unsafe_unretained|__strong|__weak|__autoreleasing}0 " "lifetime qualifier on return type is ignored">, InGroup; +def warn_excess_precision_not_supported : Warning< + "excess precisi

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-16 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: Double-checking: we want to diagnose when higher precision is requested but cannot be honored and failing to honor the request leads to an observable change in behavior and the only time that should happen currently is with complex division, so that's

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-16 Thread Zahira Ammarguellat via cfe-commits
@@ -7964,6 +7964,12 @@ class Sema final : public SemaBase { /// Do an explicit extend of the given block pointer if we're in ARC. void maybeExtendBlockObject(ExprResult &E); + std::vector> + ExcessPrecisionNotSatisfied; + unsigned NumExcessPrecisionNotSatisfied = 0;

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-16 Thread Zahira Ammarguellat via cfe-commits
https://github.com/zahiraam updated https://github.com/llvm/llvm-project/pull/107397 >From 621578de568be1e71665254060956ea1971965c9 Mon Sep 17 00:00:00 2001 From: Zahira Ammarguellat Date: Thu, 5 Sep 2024 05:42:26 -0700 Subject: [PATCH 1/8] [NFC] Move warning from COdeGen to Sema. --- clang/i

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-16 Thread Aaron Ballman via cfe-commits
@@ -7964,6 +7964,12 @@ class Sema final : public SemaBase { /// Do an explicit extend of the given block pointer if we're in ARC. void maybeExtendBlockObject(ExprResult &E); + std::vector> + ExcessPrecisionNotSatisfied; + unsigned NumExcessPrecisionNotSatisfied = 0;

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-16 Thread Aaron Ballman via cfe-commits
@@ -780,6 +780,22 @@ class ASTContext : public RefCountedBase { const TargetInfo &getTargetInfo() const { return *Target; } const TargetInfo *getAuxTargetInfo() const { return AuxTarget; } + const QualType GetHigherPrecisionFPType(QualType ElementType) const { ---

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-13 Thread Zahira Ammarguellat via cfe-commits
zahiraam wrote: Let's see if this is better. https://github.com/llvm/llvm-project/pull/107397 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-13 Thread Zahira Ammarguellat via cfe-commits
https://github.com/zahiraam updated https://github.com/llvm/llvm-project/pull/107397 >From 621578de568be1e71665254060956ea1971965c9 Mon Sep 17 00:00:00 2001 From: Zahira Ammarguellat Date: Thu, 5 Sep 2024 05:42:26 -0700 Subject: [PATCH 1/7] [NFC] Move warning from COdeGen to Sema. --- clang/i

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-13 Thread Aaron Ballman via cfe-commits
@@ -21,6 +25,7 @@ void a() { EVALF((2. + 3i) + (4. + 5i), 6. + 8i); EVALF((2. + 3i) - (4. + 5i), -2. - 2i); EVALF((2. + 3i) * (4. + 5i), -7. + 22i); + // div-precision-warning@+1 {{excess precision is requested but the target does not support excess precision which may

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-12 Thread Zahira Ammarguellat via cfe-commits
@@ -21,6 +25,7 @@ void a() { EVALF((2. + 3i) + (4. + 5i), 6. + 8i); EVALF((2. + 3i) - (4. + 5i), -2. - 2i); EVALF((2. + 3i) * (4. + 5i), -7. + 22i); + // div-precision-warning@+1 {{excess precision is requested but the target does not support excess precision which may

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-12 Thread Zahira Ammarguellat via cfe-commits
@@ -21,6 +25,7 @@ void a() { EVALF((2. + 3i) + (4. + 5i), 6. + 8i); EVALF((2. + 3i) - (4. + 5i), -2. - 2i); EVALF((2. + 3i) * (4. + 5i), -7. + 22i); + // div-precision-warning@+1 {{excess precision is requested but the target does not support excess precision which may

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-12 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > > double foo(); > > double d = 2.0 * foo(); > > That's correct. Only for division and only `-fcomplex-arithmetic=promoted` > and when the higher precision type of a target is the same than the current > precision type. Okay, then I think there's a bit more work to be don

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-12 Thread Aaron Ballman via cfe-commits
@@ -6784,6 +6784,11 @@ def warn_arc_lifetime_result_type : Warning< "ARC %select{unused|__unsafe_unretained|__strong|__weak|__autoreleasing}0 " "lifetime qualifier on return type is ignored">, InGroup; +def warn_excess_precision_not_supported : Warning< + "excess precisi

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-12 Thread Zahira Ammarguellat via cfe-commits
@@ -6784,6 +6784,11 @@ def warn_arc_lifetime_result_type : Warning< "ARC %select{unused|__unsafe_unretained|__strong|__weak|__autoreleasing}0 " "lifetime qualifier on return type is ignored">, InGroup; +def warn_excess_precision_not_supported : Warning< + "excess precisi

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-12 Thread Zahira Ammarguellat via cfe-commits
zahiraam wrote: > double foo(); > double d = 2.0 * foo(); That's correct. Only for division and only `-fcomplex-arithmetic=promoted` and when the higher precision type of a target is the same than the current precision type. https://github.com/llvm/llvm-project/pull/107397 ___

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-12 Thread Aaron Ballman via cfe-commits
@@ -7964,6 +7964,12 @@ class Sema final : public SemaBase { /// Do an explicit extend of the given block pointer if we're in ARC. void maybeExtendBlockObject(ExprResult &E); + std::vector> AaronBallman wrote: I don't think we need the `SourceLocation` an

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-12 Thread Aaron Ballman via cfe-commits
@@ -6784,6 +6784,11 @@ def warn_arc_lifetime_result_type : Warning< "ARC %select{unused|__unsafe_unretained|__strong|__weak|__autoreleasing}0 " "lifetime qualifier on return type is ignored">, InGroup; +def warn_excess_precision_not_supported : Warning< + "excess precisi

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-12 Thread Aaron Ballman via cfe-commits
@@ -21,6 +25,7 @@ void a() { EVALF((2. + 3i) + (4. + 5i), 6. + 8i); EVALF((2. + 3i) - (4. + 5i), -2. - 2i); EVALF((2. + 3i) * (4. + 5i), -7. + 22i); + // div-precision-warning@+1 {{excess precision is requested but the target does not support excess precision which may

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-12 Thread Aaron Ballman via cfe-commits
@@ -6784,6 +6784,11 @@ def warn_arc_lifetime_result_type : Warning< "ARC %select{unused|__unsafe_unretained|__strong|__weak|__autoreleasing}0 " "lifetime qualifier on return type is ignored">, InGroup; +def warn_excess_precision_not_supported : Warning< + "excess precisi

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-12 Thread Aaron Ballman via cfe-commits
@@ -7964,6 +7964,12 @@ class Sema final : public SemaBase { /// Do an explicit extend of the given block pointer if we're in ARC. void maybeExtendBlockObject(ExprResult &E); + std::vector> + ExcessPrecisionNotSatisfied; + unsigned NumExcessPrecisionNotSatisfied = 0;

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-12 Thread Aaron Ballman via cfe-commits
@@ -1180,6 +1180,14 @@ void Sema::PrintPragmaAttributeInstantiationPoint() { diag::note_pragma_attribute_applied_decl_here); } +void Sema::DiagnoseExcessPrecision() { + if (NumExcessPrecisionNotSatisfied > 0) { +for (auto &[Loc, Type, Num] : ExcessPrecision

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-12 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/107397 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-12 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman commented: We're currently only tracking the precision loss for complex division, but doesn't it also apply to any use of a floating-point type? e.g., ``` double foo(); double d = 2.0 * foo(); ``` would still not use the higher precision, right? The only differenc

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-12 Thread Aaron Ballman via cfe-commits
@@ -6784,6 +6784,11 @@ def warn_arc_lifetime_result_type : Warning< "ARC %select{unused|__unsafe_unretained|__strong|__weak|__autoreleasing}0 " "lifetime qualifier on return type is ignored">, InGroup; +def warn_excess_precision_not_supported : Warning< + "excess precisi

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-12 Thread Zahira Ammarguellat via cfe-commits
https://github.com/zahiraam updated https://github.com/llvm/llvm-project/pull/107397 >From 621578de568be1e71665254060956ea1971965c9 Mon Sep 17 00:00:00 2001 From: Zahira Ammarguellat Date: Thu, 5 Sep 2024 05:42:26 -0700 Subject: [PATCH 1/6] [NFC] Move warning from COdeGen to Sema. --- clang/i

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-12 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff f77f60400f7a4c0c50bc3e3144cdade3bdf9aa3d 51acb49fa02ce4306e251649d7d7d23c65477d07 --e

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-12 Thread Zahira Ammarguellat via cfe-commits
https://github.com/zahiraam updated https://github.com/llvm/llvm-project/pull/107397 >From 621578de568be1e71665254060956ea1971965c9 Mon Sep 17 00:00:00 2001 From: Zahira Ammarguellat Date: Thu, 5 Sep 2024 05:42:26 -0700 Subject: [PATCH 1/5] [NFC] Move warning from COdeGen to Sema. --- clang/i

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-12 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll edited https://github.com/llvm/llvm-project/pull/107397 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-12 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll edited https://github.com/llvm/llvm-project/pull/107397 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-12 Thread Vlad Serebrennikov via cfe-commits
@@ -626,6 +626,11 @@ class Sema final : public SemaBase { const llvm::MapVector & getMismatchingDeleteExpressions() const; + std::vector> + ExcessPrecisionNotSatisfied; Endilll wrote: Or `(Num >1 ? 1 : 0)` if you wany https://github.com/llvm/llvm-p

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-12 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll edited https://github.com/llvm/llvm-project/pull/107397 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-12 Thread Vlad Serebrennikov via cfe-commits
@@ -1180,6 +1180,16 @@ void Sema::PrintPragmaAttributeInstantiationPoint() { diag::note_pragma_attribute_applied_decl_here); } +void Sema::DiagnoseExcessPrecision() { + if (NumExcessPrecisionNotSatisfied > 0) { +for (auto &[Loc, Type, Num] : ExcessPrecision

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-12 Thread Vlad Serebrennikov via cfe-commits
@@ -626,6 +626,11 @@ class Sema final : public SemaBase { const llvm::MapVector & getMismatchingDeleteExpressions() const; + std::vector> + ExcessPrecisionNotSatisfied; Endilll wrote: I think all three data members should be moved down to `SemaExpr.

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-12 Thread Vlad Serebrennikov via cfe-commits
@@ -1180,6 +1180,16 @@ void Sema::PrintPragmaAttributeInstantiationPoint() { diag::note_pragma_attribute_applied_decl_here); } +void Sema::DiagnoseExcessPrecision() { + if (NumExcessPrecisionNotSatisfied > 0) { +for (auto &[Loc, Type, Num] : ExcessPrecision

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-12 Thread Zahira Ammarguellat via cfe-commits
https://github.com/zahiraam updated https://github.com/llvm/llvm-project/pull/107397 >From 621578de568be1e71665254060956ea1971965c9 Mon Sep 17 00:00:00 2001 From: Zahira Ammarguellat Date: Thu, 5 Sep 2024 05:42:26 -0700 Subject: [PATCH 1/4] [NFC] Move warning from COdeGen to Sema. --- clang/i

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-10 Thread Zahira Ammarguellat via cfe-commits
@@ -6784,6 +6784,10 @@ def warn_arc_lifetime_result_type : Warning< "ARC %select{unused|__unsafe_unretained|__strong|__weak|__autoreleasing}0 " "lifetime qualifier on return type is ignored">, InGroup; +def warn_next_larger_fp_type_same_size_than_fp : Warning< + "higher

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-10 Thread Zahira Ammarguellat via cfe-commits
@@ -6784,6 +6784,10 @@ def warn_arc_lifetime_result_type : Warning< "ARC %select{unused|__unsafe_unretained|__strong|__weak|__autoreleasing}0 " "lifetime qualifier on return type is ignored">, InGroup; +def warn_next_larger_fp_type_same_size_than_fp : Warning< + "higher

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-10 Thread Aaron Ballman via cfe-commits
@@ -6784,6 +6784,10 @@ def warn_arc_lifetime_result_type : Warning< "ARC %select{unused|__unsafe_unretained|__strong|__weak|__autoreleasing}0 " "lifetime qualifier on return type is ignored">, InGroup; +def warn_next_larger_fp_type_same_size_than_fp : Warning< + "higher

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-09 Thread Eli Friedman via cfe-commits
@@ -6784,6 +6784,10 @@ def warn_arc_lifetime_result_type : Warning< "ARC %select{unused|__unsafe_unretained|__strong|__weak|__autoreleasing}0 " "lifetime qualifier on return type is ignored">, InGroup; +def warn_next_larger_fp_type_same_size_than_fp : Warning< + "higher

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-09 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang @llvm/pr-subscribers-clang-codegen Author: Zahira Ammarguellat (zahiraam) Changes This is a warning that wasn't associated with the source location. Moved it to Sema and changed the warning message to a more verbose one. --- Full diff: https://gi

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-09 Thread Zahira Ammarguellat via cfe-commits
https://github.com/zahiraam ready_for_review https://github.com/llvm/llvm-project/pull/107397 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-06 Thread Zahira Ammarguellat via cfe-commits
https://github.com/zahiraam updated https://github.com/llvm/llvm-project/pull/107397 >From 621578de568be1e71665254060956ea1971965c9 Mon Sep 17 00:00:00 2001 From: Zahira Ammarguellat Date: Thu, 5 Sep 2024 05:42:26 -0700 Subject: [PATCH 1/3] [NFC] Move warning from COdeGen to Sema. --- clang/i

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-06 Thread Zahira Ammarguellat via cfe-commits
https://github.com/zahiraam updated https://github.com/llvm/llvm-project/pull/107397 >From 621578de568be1e71665254060956ea1971965c9 Mon Sep 17 00:00:00 2001 From: Zahira Ammarguellat Date: Thu, 5 Sep 2024 05:42:26 -0700 Subject: [PATCH 1/2] [NFC] Move warning from COdeGen to Sema. --- clang/i

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-05 Thread Zahira Ammarguellat via cfe-commits
https://github.com/zahiraam edited https://github.com/llvm/llvm-project/pull/107397 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC] Move warning from CodeGen to Sema. (PR #107397)

2024-09-05 Thread Zahira Ammarguellat via cfe-commits
https://github.com/zahiraam edited https://github.com/llvm/llvm-project/pull/107397 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFC] Move warning from COdeGen to Sema. (PR #107397)

2024-09-05 Thread Zahira Ammarguellat via cfe-commits
https://github.com/zahiraam created https://github.com/llvm/llvm-project/pull/107397 None >From 621578de568be1e71665254060956ea1971965c9 Mon Sep 17 00:00:00 2001 From: Zahira Ammarguellat Date: Thu, 5 Sep 2024 05:42:26 -0700 Subject: [PATCH] [NFC] Move warning from COdeGen to Sema. --- clang