diff --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp --- a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp +++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp @@ -2926,7 +2926,7 @@ return all_of(callOp.getAttributeNames(), [&](StringRef attrName) { return llvm::StringSwitch(attrName) // TODO: Propagate and update branch weights. - .Case("branch_weights", !callOp.getBranchWeights()) + .Case("branch_weights", true) .Case("callee", true) .Case("fastmathFlags", true) .Default(false); diff --git a/mlir/test/Dialect/LLVMIR/inlining.mlir b/mlir/test/Dialect/LLVMIR/inlining.mlir --- a/mlir/test/Dialect/LLVMIR/inlining.mlir +++ b/mlir/test/Dialect/LLVMIR/inlining.mlir @@ -83,7 +83,7 @@ // CHECK-NEXT: llvm.return %[[CST]] llvm.func @caller() -> (i32) { // Include all call attributes that don't prevent inlining. - %0 = llvm.call @callee() { fastmathFlags = #llvm.fastmath } : () -> (i32) + %0 = llvm.call @callee() { fastmathFlags = #llvm.fastmath, branch_weights = dense<42> : vector<1xi32> } : () -> (i32) llvm.return %0 : i32 } @@ -191,20 +191,6 @@ // ----- -llvm.func @callee() { - llvm.return -} - -// CHECK-LABEL: llvm.func @caller -// CHECK-NEXT: llvm.call @callee -// CHECK-NEXT: llvm.return -llvm.func @caller() { - llvm.call @callee() { branch_weights = dense<42> : vector<1xi32> } : () -> () - llvm.return -} - -// ----- - llvm.func @static_alloca() -> f32 { %0 = llvm.mlir.constant(4 : i32) : i32 %1 = llvm.alloca %0 x f32 : (i32) -> !llvm.ptr