Skip to content

Commit 253ac70

Browse files
committed
Emit builtin_constant_p
1 parent 07ec6ca commit 253ac70

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tools/cgeist/Lib/CGCall.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include "TypeUtils.h"
1010
#include "clang-mlir.h"
11+
#include "mlir/Dialect/Arith/IR/Arith.h"
1112
#include "mlir/Dialect/GPU/IR/GPUDialect.h"
1213
#include "utils.h"
1314
#include "clang/Basic/Builtins.h"
@@ -435,6 +436,14 @@ MLIRScanner::EmitClangBuiltinCallExpr(clang::CallExpr *expr) {
435436
}
436437
return make_pair(nullptr, true);
437438
}
439+
case Builtin::BI__builtin_constant_p: {
440+
auto resultType = getMLIRType(expr->getType());
441+
llvm::errs() << "warning: assuming __builtin_constant_p to be false\n";
442+
return make_pair(
443+
ValueCategory(builder.create<arith::ConstantIntOp>(loc, 0, resultType),
444+
/*isRef*/ false),
445+
true);
446+
}
438447
default:
439448
break;
440449
}

0 commit comments

Comments
 (0)