https://github.com/overmighty created
https://github.com/llvm/llvm-project/pull/86742
See https://github.com/llvm/llvm-project/pull/86577#discussion_r1540069558.
cc @efriedma-quic @nickdesaulniers
>From c615f656153fcb1d4158548660f87d1d69960864 Mon Sep 17 00:00:00 2001
From: OverMighty
Date: T
llvmbot wrote:
@llvm/pr-subscribers-clang
Author: OverMighty (overmighty)
Changes
See https://github.com/llvm/llvm-project/pull/86577#discussion_r1540069558.
cc @efriedma-quic @nickdesaulniers
---
Full diff: https://github.com/llvm/llvm-project/pull/86742.diff
2 Files Affected:
- (mod
@@ -12425,12 +12430,17 @@ bool IntExprEvaluator::VisitBuiltinCallExpr(const
CallExpr *E,
if (!EvaluateInteger(E->getArg(0), Val, Info))
return false;
+std::optional Fallback;
+if (BuiltinOp == Builtin::BI__builtin_ctzg && E->getNumArgs() > 1) {
+ APSInt
@@ -0,0 +1,39 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
+
+constexpr int increment(int& x) {
+ x++;
+ return x;
+}
+
+constexpr int test_clzg_0() {
+ int x = 0;
+ [[maybe_unused]] int unused = __builtin_clzg(0U, increment(x));
+ return x;
+}
@@ -0,0 +1,39 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
+
+constexpr int increment(int& x) {
+ x++;
+ return x;
+}
+
+constexpr int test_clzg_0() {
+ int x = 0;
+ [[maybe_unused]] int unused = __builtin_clzg(0U, increment(x));
+ return x;
+}
@@ -0,0 +1,39 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
+
+constexpr int increment(int& x) {
+ x++;
+ return x;
+}
+
+constexpr int test_clzg_0() {
+ int x = 0;
+ [[maybe_unused]] int unused = __builtin_clzg(0U, increment(x));
+ return x;
+}
@@ -0,0 +1,39 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
+
+constexpr int increment(int& x) {
+ x++;
+ return x;
+}
+
+constexpr int test_clzg_0() {
+ int x = 0;
+ [[maybe_unused]] int unused = __builtin_clzg(0U, increment(x));
+ return x;
+}
@@ -0,0 +1,39 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
+
+constexpr int increment(int& x) {
+ x++;
+ return x;
+}
+
+constexpr int test_clzg_0() {
+ int x = 0;
+ [[maybe_unused]] int unused = __builtin_clzg(0U, increment(x));
+ return x;
+}
https://github.com/overmighty updated
https://github.com/llvm/llvm-project/pull/86742
>From c615f656153fcb1d4158548660f87d1d69960864 Mon Sep 17 00:00:00 2001
From: OverMighty
Date: Tue, 26 Mar 2024 21:25:59 +
Subject: [PATCH 1/2] [clang][ExprConst] Fix second arg of
__builtin_{clzg,ctzg} n
https://github.com/efriedma-quic approved this pull request.
LGTM
https://github.com/llvm/llvm-project/pull/86742
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,39 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
+
+constexpr int increment(int& x) {
+ x++;
+ return x;
+}
+
+constexpr int test_clzg_0() {
+ int x = 0;
+ (void)__builtin_clzg(0U, increment(x));
overmighty wrote:
Rand
https://github.com/overmighty updated
https://github.com/llvm/llvm-project/pull/86742
>From c615f656153fcb1d4158548660f87d1d69960864 Mon Sep 17 00:00:00 2001
From: OverMighty
Date: Tue, 26 Mar 2024 21:25:59 +
Subject: [PATCH 1/3] [clang][ExprConst] Fix second arg of
__builtin_{clzg,ctzg} n
https://github.com/nickdesaulniers approved this pull request.
https://github.com/llvm/llvm-project/pull/86742
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
overmighty wrote:
Could someone merge this for me if it looks good to everyone?
https://github.com/llvm/llvm-project/pull/86742
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/efriedma-quic closed
https://github.com/llvm/llvm-project/pull/86742
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
15 matches
Mail list logo