Author: Timm Bäder Date: 2024-02-05T17:33:08+01:00 New Revision: 66cd768504b349f7bd16d236a3b4f611ffabf78f
URL: https://github.com/llvm/llvm-project/commit/66cd768504b349f7bd16d236a3b4f611ffabf78f DIFF: https://github.com/llvm/llvm-project/commit/66cd768504b349f7bd16d236a3b4f611ffabf78f.diff LOG: [clang][Interp] Handle __assume like __builtin_assume. Added: Modified: clang/lib/AST/Interp/InterpBuiltin.cpp clang/test/AST/Interp/builtins.cpp Removed: ################################################################################ diff --git a/clang/lib/AST/Interp/InterpBuiltin.cpp b/clang/lib/AST/Interp/InterpBuiltin.cpp index 280aa39398c8e..5976d4c3e7131 100644 --- a/clang/lib/AST/Interp/InterpBuiltin.cpp +++ b/clang/lib/AST/Interp/InterpBuiltin.cpp @@ -660,6 +660,7 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const Function *F, S.Stk.push<Boolean>(Boolean::from(S.inConstantContext())); break; case Builtin::BI__builtin_assume: + case Builtin::BI__assume: break; case Builtin::BI__builtin_strcmp: if (!interp__builtin_strcmp(S, OpPC, Frame)) diff --git a/clang/test/AST/Interp/builtins.cpp b/clang/test/AST/Interp/builtins.cpp index 5e2ffe50f3740..06a22b16b2dcb 100644 --- a/clang/test/AST/Interp/builtins.cpp +++ b/clang/test/AST/Interp/builtins.cpp @@ -1,7 +1,7 @@ -// RUN: %clang_cc1 -fexperimental-new-constant-interpreter %s -verify -// RUN: %clang_cc1 -fexperimental-new-constant-interpreter %s -S -emit-llvm -o - | FileCheck %s -// RUN: %clang_cc1 -verify=ref %s -Wno-constant-evaluated -// RUN: %clang_cc1 -verify=ref %s -Wno-constant-evaluated %s -S -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -fexperimental-new-constant-interpreter %s -verify -fms-extensions +// RUN: %clang_cc1 -fexperimental-new-constant-interpreter %s -fms-extensions -S -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -verify=ref %s -Wno-constant-evaluated -fms-extensions +// RUN: %clang_cc1 -verify=ref %s -Wno-constant-evaluated %s -fms-extensions -S -emit-llvm -o - | FileCheck %s // expected-no-diagnostics // ref-no-diagnostics @@ -26,6 +26,8 @@ bool is_this_constant() { constexpr bool assume() { __builtin_assume(true); __builtin_assume(false); + __assume(1); + __assume(false); return true; } static_assert(assume(), ""); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits