Handle __builtin_expect (#268)

* Handle builtin_expect

* add warning
This commit is contained in:
Ivan 2022-09-14 16:27:12 +09:00 committed by GitHub
parent 5d40003a8b
commit 8a21abf73e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -561,6 +561,14 @@ ValueCategory MLIRScanner::VisitCallExpr(clang::CallExpr *expr) {
/*isReference*/ false);
}
}
if (auto *ic = dyn_cast<ImplicitCastExpr>(expr->getCallee()))
if (auto *sr = dyn_cast<DeclRefExpr>(ic->getSubExpr())) {
if (sr->getDecl()->getIdentifier() &&
sr->getDecl()->getName() == "__builtin_expect") {
llvm::errs() << "warning, ignoring __builtin_expect\n";
return Visit(expr->getArg(0));
}
}
if (auto *ic = dyn_cast<ImplicitCastExpr>(expr->getCallee()))
if (auto *sr = dyn_cast<DeclRefExpr>(ic->getSubExpr())) {
if (sr->getDecl()->getIdentifier() &&