[flang-commits] [flang] [flang]: This is to fix the HLFIR path for PPC Vector type intrinsics. (PR #66547)

via flang-commits flang-commits at lists.llvm.org
Fri Sep 15 13:33:54 PDT 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-flang-fir-hlfir

<details>
<summary>Changes</summary>

PowerPC Vector type intrinsics currently crashes with `-flang-experimental-hlfir` is specified.

This patch is to fix the HLFIR path for PowerPC Vector type intrinsics.
---
Full diff: https://github.com/llvm/llvm-project/pull/66547.diff


3 Files Affected:

- (modified) flang/include/flang/Optimizer/Dialect/FIRType.h (+6-1) 
- (modified) flang/lib/Lower/ConvertCall.cpp (+2-1) 
- (modified) flang/lib/Optimizer/HLFIR/IR/HLFIRDialect.cpp (+1) 


``````````diff
diff --git a/flang/include/flang/Optimizer/Dialect/FIRType.h b/flang/include/flang/Optimizer/Dialect/FIRType.h
index bbc862483aea6da..77807ea2a308c67 100644
--- a/flang/include/flang/Optimizer/Dialect/FIRType.h
+++ b/flang/include/flang/Optimizer/Dialect/FIRType.h
@@ -146,6 +146,11 @@ inline bool isa_integer(mlir::Type t) {
   return t.isa<mlir::IndexType, mlir::IntegerType, fir::IntegerType>();
 }
 
+/// Is `t` a vector type?
+inline bool isa_vector(mlir::Type t) {
+  return t.isa<mlir::VectorType, fir::VectorType>();
+}
+
 mlir::Type parseFirType(FIROpsDialect *, mlir::DialectAsmParser &parser);
 
 void printFirType(FIROpsDialect *, mlir::Type ty, mlir::DialectAsmPrinter &p);
@@ -165,7 +170,7 @@ inline bool isa_char(mlir::Type t) { return t.isa<fir::CharacterType>(); }
 /// Is `t` a trivial intrinsic type? CHARACTER is <em>excluded</em> because it
 /// is a dependent type.
 inline bool isa_trivial(mlir::Type t) {
-  return isa_integer(t) || isa_real(t) || isa_complex(t) ||
+  return isa_integer(t) || isa_real(t) || isa_complex(t) || isa_vector(t) ||
          t.isa<fir::LogicalType>();
 }
 
diff --git a/flang/lib/Lower/ConvertCall.cpp b/flang/lib/Lower/ConvertCall.cpp
index 15915b02aebaa70..550cb987a37954f 100644
--- a/flang/lib/Lower/ConvertCall.cpp
+++ b/flang/lib/Lower/ConvertCall.cpp
@@ -1491,7 +1491,8 @@ genIntrinsicRefCore(Fortran::lower::PreparedActualArguments &loweredActuals,
   const std::string intrinsicName = callContext.getProcedureName();
   // Let the intrinsic library lower the intrinsic procedure call.
   auto [resultExv, mustBeFreed] =
-      genIntrinsicCall(builder, loc, intrinsicName, scalarResultType, operands);
+      genIntrinsicCall(builder, loc, intrinsicName, scalarResultType, operands,
+		       &converter);
   for (const hlfir::CleanupFunction &fn : cleanupFns)
     fn();
   if (!fir::getBase(resultExv))
diff --git a/flang/lib/Optimizer/HLFIR/IR/HLFIRDialect.cpp b/flang/lib/Optimizer/HLFIR/IR/HLFIRDialect.cpp
index 7ca6108a31acbb6..64540c77d9b7908 100644
--- a/flang/lib/Optimizer/HLFIR/IR/HLFIRDialect.cpp
+++ b/flang/lib/Optimizer/HLFIR/IR/HLFIRDialect.cpp
@@ -87,6 +87,7 @@ bool hlfir::isFortranVariableType(mlir::Type type) {
         return eleType.isa<fir::BaseBoxType>() || !fir::hasDynamicSize(eleType);
       })
       .Case<fir::BaseBoxType, fir::BoxCharType>([](auto) { return true; })
+      .Case<fir::VectorType>([](auto) { return true; })
       .Default([](mlir::Type) { return false; });
 }
 

``````````

</details>


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


More information about the flang-commits mailing list