mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-09 21:47:47 +00:00
tint/transform/builtin_polyfill: Don't polyfill @const builtins
We don't want to replace builtins that are constant-expression evaluated, as the replacement cannot be used as a constant expression. Fixed: tint:1667 Change-Id: I554d9884fc41890247ee64b47a70621be5fcdbe5 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107680 Reviewed-by: Antonio Maiorano <amaiorano@google.com> Auto-Submit: Ben Clayton <bclayton@google.com> Commit-Queue: Ben Clayton <bclayton@google.com> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
23945c5d27
commit
46de10299f
@@ -569,6 +569,9 @@ bool BuiltinPolyfill::ShouldRun(const Program* program, const DataMap& data) con
|
||||
for (auto* node : program->ASTNodes().Objects()) {
|
||||
if (auto* call = sem.Get<sem::Call>(node)) {
|
||||
if (auto* builtin = call->Target()->As<sem::Builtin>()) {
|
||||
if (call->Stage() == sem::EvaluationStage::kConstant) {
|
||||
continue; // Don't polyfill @const expressions
|
||||
}
|
||||
switch (builtin->Type()) {
|
||||
case sem::BuiltinType::kAcosh:
|
||||
if (builtins.acosh != Level::kNone) {
|
||||
@@ -653,6 +656,9 @@ void BuiltinPolyfill::Run(CloneContext& ctx, const DataMap& data, DataMap&) cons
|
||||
State s{ctx, builtins};
|
||||
if (auto* call = s.sem.Get<sem::Call>(expr)) {
|
||||
if (auto* builtin = call->Target()->As<sem::Builtin>()) {
|
||||
if (call->Stage() == sem::EvaluationStage::kConstant) {
|
||||
return nullptr; // Don't polyfill @const expressions
|
||||
}
|
||||
Symbol polyfill;
|
||||
switch (builtin->Type()) {
|
||||
case sem::BuiltinType::kAcosh:
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user