[clang] [CIR] Add Extend (signext/zeroext) handling to CallConvLowering (PR #195745)

via cfe-commits cfe-commits at lists.llvm.org
Wed May 27 15:00:48 PDT 2026


================
@@ -124,6 +135,67 @@ Value createIgnoredValue(OpBuilder &builder, Location loc, Type ty) {
   return cir::ConstantOp::create(builder, loc, ty, cir::PoisonAttr::get(ty));
 }
 
+/// Build an updated arg_attrs ArrayAttr that drops Ignore'd args and adds
+/// llvm.signext / llvm.zeroext on Extend args.  Preserves any existing arg
+/// attributes on retained arg slots.
+ArrayAttr updateArgAttrs(MLIRContext *ctx, unsigned numNewArgs,
+                         ArrayAttr existingArgAttrs,
+                         const FunctionClassification &fc) {
+  SmallVector<Attribute> newArgAttrs(numNewArgs, DictionaryAttr::get(ctx));
+
+  // Step 1: copy existing arg attrs over to their new positions, skipping
+  // Ignore'd args.
----------------
adams381 wrote:

The two-step approach is gone — the refactor collapses everything into a single `updateArgAttrs` pass that skips Ignores and layers signext/zeroext on Extends in one iteration.

https://github.com/llvm/llvm-project/pull/195745


More information about the cfe-commits mailing list