[Mlir-commits] [mlir] cd9a692 - Fix LLVM Dialect LoopOptionsAttr round-tripping: the keywords were missing in the output

Mehdi Amini llvmlistbot at llvm.org
Tue Mar 9 14:00:31 PST 2021


Author: Mehdi Amini
Date: 2021-03-09T22:00:22Z
New Revision: cd9a69289c7825d54450cb6829fef2c8e0f1963a

URL: https://github.com/llvm/llvm-project/commit/cd9a69289c7825d54450cb6829fef2c8e0f1963a
DIFF: https://github.com/llvm/llvm-project/commit/cd9a69289c7825d54450cb6829fef2c8e0f1963a.diff

LOG: Fix LLVM Dialect LoopOptionsAttr round-tripping: the keywords were missing in the output

This indicated some missing test coverage, which are now added to the
roundtrip test.

Added: 
    

Modified: 
    mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
    mlir/test/Dialect/LLVMIR/roundtrip.mlir

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
index 414a718323aa..d457309927e4 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
@@ -2475,6 +2475,7 @@ LoopOptionsAttr LoopOptionsAttr::get(MLIRContext *context,
 void LoopOptionsAttr::print(DialectAsmPrinter &printer) const {
   printer << getMnemonic() << "<";
   llvm::interleaveComma(getOptions(), printer, [&](auto option) {
+    printer << stringifyEnum(option.first) << " = ";
     switch (option.first) {
     case LoopOptionCase::disable_licm:
     case LoopOptionCase::disable_unroll:

diff  --git a/mlir/test/Dialect/LLVMIR/roundtrip.mlir b/mlir/test/Dialect/LLVMIR/roundtrip.mlir
index b202432ccbae..35a412ed55ed 100644
--- a/mlir/test/Dialect/LLVMIR/roundtrip.mlir
+++ b/mlir/test/Dialect/LLVMIR/roundtrip.mlir
@@ -421,6 +421,14 @@ func @fastmathFlags(%arg0: f32, %arg1: f32, %arg2: i32) {
 }
 
 module {
+  // CHECK-LABEL: @loopOptions
+  llvm.func @loopOptions() {
+    // CHECK: llvm.br
+    // CHECK-SAME: llvm.loop = {options = #llvm.loopopts<disable_unroll = true, disable_licm = true, interleave_count = 1>}, parallel_access = [@metadata::@group1]}
+    llvm.br ^bb1 {llvm.loop = {options = #llvm.loopopts<disable_unroll = true, disable_licm = true, interleave_count = 1>}, parallel_access = [@metadata::@group1]}
+  ^bb1:
+    llvm.return
+  }
   // CHECK: llvm.metadata @metadata attributes {test_attribute} {
   llvm.metadata @metadata attributes {test_attribute} {
     // CHECK: llvm.access_group @group1


        


More information about the Mlir-commits mailing list