[flang-commits] [flang] 52d813e - [fir] Use notifyMatchFailure in fir.zero_bits conversion

Valentin Clement via flang-commits flang-commits at lists.llvm.org
Wed Nov 3 12:45:29 PDT 2021


Author: Valentin Clement
Date: 2021-11-03T20:45:24+01:00
New Revision: 52d813edcc78f1e616da7bea61f7e6ad8a5b441a

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

LOG: [fir] Use notifyMatchFailure in fir.zero_bits conversion

Change emitOpError to notifyMatchFailure in conversion pattern.

Post-commit change after D113014

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D113091

Added: 
    

Modified: 
    flang/lib/Optimizer/CodeGen/CodeGen.cpp
    flang/test/Fir/convert-to-llvm-invalid.fir

Removed: 
    


################################################################################
diff  --git a/flang/lib/Optimizer/CodeGen/CodeGen.cpp b/flang/lib/Optimizer/CodeGen/CodeGen.cpp
index 15ac2d7cb45f..d7b0f819e9da 100644
--- a/flang/lib/Optimizer/CodeGen/CodeGen.cpp
+++ b/flang/lib/Optimizer/CodeGen/CodeGen.cpp
@@ -196,7 +196,8 @@ struct ZeroOpConversion : public FIROpConversion<fir::ZeroOp> {
           zero, ty, mlir::FloatAttr::get(zero.getType(), 0.0));
     } else {
       // TODO: create ConstantAggregateZero for FIR aggregate/array types.
-      return zero.emitOpError(
+      return rewriter.notifyMatchFailure(
+          zero,
           "conversion of fir.zero with aggregate type not implemented yet");
     }
     return success();

diff  --git a/flang/test/Fir/convert-to-llvm-invalid.fir b/flang/test/Fir/convert-to-llvm-invalid.fir
index 00db627d05be..3ee008860ba7 100644
--- a/flang/test/Fir/convert-to-llvm-invalid.fir
+++ b/flang/test/Fir/convert-to-llvm-invalid.fir
@@ -3,7 +3,6 @@
 // RUN: fir-opt --split-input-file --fir-to-llvm-ir --verify-diagnostics %s
 
 func @zero_aggregate() {
-  // expected-error at +2{{'fir.zero_bits' op conversion of fir.zero with aggregate type not implemented yet}}
   // expected-error at +1{{failed to legalize operation 'fir.zero_bits'}}
   %a = fir.zero_bits !fir.array<10xf32>
   return


        


More information about the flang-commits mailing list