================
@@ -677,6 +753,35 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl
&gd, unsigned builtinID,
cir::VACopyOp::create(builder, dstPtr.getLoc(), dstPtr, srcPtr);
return {};
}
+
+ case Builtin::BIabs:
+ case Builtin::BIlabs:
+ case Builtin::BIllabs:
+ case Builtin::BI__builtin_abs:
+ case Builtin::BI__builtin_labs:
+ case Builtin::BI__builtin_llabs: {
+ bool sanitizeOverflow = sanOpts.has(SanitizerKind::SignedIntegerOverflow);
+ mlir::Value arg = emitScalarExpr(e->getArg(0));
+ mlir::Value result;
+ switch (getLangOpts().getSignedOverflowBehavior()) {
+ case LangOptions::SOB_Defined:
+ result = cir::AbsOp::create(builder, loc, arg.getType(), arg,
+ /*minIsPoison=*/false);
+ break;
+ case LangOptions::SOB_Undefined:
+ if (!sanitizeOverflow) {
+ result = cir::AbsOp::create(builder, loc, arg.getType(), arg,
+ /*minIsPoison=*/true);
+ break;
+ }
+ [[fallthrough]];
+ case LangOptions::SOB_Trapping:
+ cgm.errorNYI(e->getSourceRange(), "abs with overflow handling");
+ return RValue::get(nullptr);
----------------
HendrikHuebner wrote:
```suggestion
return RValue::getIgnored();
```
https://github.com/llvm/llvm-project/pull/175233
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits