Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CIRAsm build failure due to upstream change #1254

Open
lanza opened this issue Dec 22, 2024 · 2 comments
Open

CIRAsm build failure due to upstream change #1254

lanza opened this issue Dec 22, 2024 · 2 comments

Comments

@lanza
Copy link
Member

lanza commented Dec 22, 2024

I started a rebase the other day and hit a build failure on llvm/llvm-project@9df63b2. 5e80a81 conflicts with it due to the operand type being llvm::SmallVector<llvm::ArrayRef<mlir::ValueRange>>>. I'm not really sure what the problem is here. Any chance you could take a look @gitoleg?

I pushed the branch to state of the rebase to this branch https://github.com/llvm/clangir/tree/asm_build_failure.

@gitoleg
Copy link
Collaborator

gitoleg commented Dec 23, 2024

@lanza I will!! Today or tomorrow

@gitoleg
Copy link
Collaborator

gitoleg commented Dec 23, 2024

@lanza
it was bad idea to name asm operands as operands. So we can just rename them as (for example) asm_operands in CIROps.td and rename getOperands() in the lowering and for printing as getAsmOperands() as well.
So you need to change three files:

  • CIROps.td
  • LowerToLLVM.cpp
  • CIRDialect.cpp
diff --git a/clang/include/clang/CIR/Dialect/IR/CIROps.td b/clang/include/clang/CIR/Dialect/IR/CIROps.td
index 77d06ea0f4b6..40fb6cc04539 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIROps.td
+++ b/clang/include/clang/CIR/Dialect/IR/CIROps.td
@@ -3378,7 +3378,7 @@ def CIR_InlineAsmOp : CIR_Op<"asm", [RecursiveMemoryEffects]> {
   let results = (outs Optional<CIR_AnyType>:$res);
 
   let arguments = (
-    ins VariadicOfVariadic<AnyType, "operands_segments">:$operands,
+    ins VariadicOfVariadic<AnyType, "operands_segments">:$asm_operands,
         StrAttr:$asm_string,
         StrAttr:$constraints,
         UnitAttr:$side_effects,
@@ -3388,7 +3388,7 @@ def CIR_InlineAsmOp : CIR_Op<"asm", [RecursiveMemoryEffects]> {
         );
 
   let builders = [OpBuilder<(ins
-    "ArrayRef<ValueRange>":$operands,
+    "ArrayRef<ValueRange>":$asm_operands,
     "StringRef":$asm_string,
     "StringRef":$constraints,
     "bool":$side_effects,
diff --git a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp
index 32e833b6c9ad..1e0782da0c8d 100644
--- a/clang/lib/CIR/Dialect/IR/CIRDialect.cpp
+++ b/clang/lib/CIR/Dialect/IR/CIRDialect.cpp
@@ -2764,7 +2764,7 @@ void cir::InlineAsmOp::print(OpAsmPrinter &p) {
   auto nameIt = names.begin();
   auto attrIt = getOperandAttrs().begin();
 
-  for (auto ops : getOperands()) {
+  for (auto ops : getAsmOperands()) {
     p << *nameIt << " = ";
 
     p << '[';
diff --git a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
index 8778a63c3b4b..54e7683b3bf5 100644
--- a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
+++ b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
@@ -2863,9 +2863,9 @@ class CIRInlineAsmOpLowering
 
     llvm::SmallVector<mlir::Value> llvmOperands;
     llvm::SmallVector<mlir::Value> cirOperands;
-    for (size_t i = 0; i < op.getOperands().size(); ++i) {
-      auto llvmOps = adaptor.getOperands()[i];
-      auto cirOps = op.getOperands()[i];
+    for (size_t i = 0; i < op.getAsmOperands().size(); ++i) {
+      auto llvmOps = adaptor.getAsmOperands()[i];
+      auto cirOps = op.getAsmOperands()[i];
       llvmOperands.insert(llvmOperands.end(), llvmOps.begin(), llvmOps.end());
       cirOperands.insert(cirOperands.end(), cirOps.begin(), cirOps.end());
     }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants