Skip to content

Commit 8a21abf

Browse files
authored
Handle __builtin_expect (#268)
* Handle builtin_expect * add warning
1 parent 5d40003 commit 8a21abf

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tools/cgeist/Lib/CGCall.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,14 @@ ValueCategory MLIRScanner::VisitCallExpr(clang::CallExpr *expr) {
561561
/*isReference*/ false);
562562
}
563563
}
564+
if (auto *ic = dyn_cast<ImplicitCastExpr>(expr->getCallee()))
565+
if (auto *sr = dyn_cast<DeclRefExpr>(ic->getSubExpr())) {
566+
if (sr->getDecl()->getIdentifier() &&
567+
sr->getDecl()->getName() == "__builtin_expect") {
568+
llvm::errs() << "warning, ignoring __builtin_expect\n";
569+
return Visit(expr->getArg(0));
570+
}
571+
}
564572
if (auto *ic = dyn_cast<ImplicitCastExpr>(expr->getCallee()))
565573
if (auto *sr = dyn_cast<DeclRefExpr>(ic->getSubExpr())) {
566574
if (sr->getDecl()->getIdentifier() &&

0 commit comments

Comments
 (0)