Skip to content

Commit

Permalink
[flang] Fix flang after MLIR update
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Niu committed Dec 9, 2022
1 parent 225ce67 commit 1897b67
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion flang/lib/Optimizer/CodeGen/TargetRewrite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,8 @@ class TargetRewrite : public fir::impl::TargetRewritePassBase<TargetRewrite> {
// correctly.
for (auto e : llvm::enumerate(funcTy.getInputs())) {
unsigned index = e.index();
llvm::ArrayRef<mlir::NamedAttribute> attrs = func.getArgAttrs(index);
llvm::ArrayRef<mlir::NamedAttribute> attrs =
mlir::function_interface_impl::getArgAttrs(func, index);
for (mlir::NamedAttribute attr : attrs) {
savedAttrs.push_back({index, attr});
}
Expand Down

4 comments on commit 1897b67

@kazutakahirata
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for fixing the flang build. Now, even with this patch, I am getting:

Failed Tests (5):
  Flang :: Fir/boxproc.fir
  Flang :: Fir/target-rewrite-arg-position.fir
  Flang :: Fir/target-rewrite-boxchar.fir
  Flang :: Fir/target-rewrite-char-proc.fir
  Flang :: Fir/target.fir

Before dd74e6b, I did not get these failures. Would you mind looking into these? Thanks!

@psteinfeld
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Mogball, my tests are also failing.

Can you please add me as a reviewer to any future changes related to this?

Here's a sample program that causes problems:

subroutine sub(s)
  character(3) s
  print *,len(s)
end

After building flang with this change, if I go to my build directory and execute the command:

flang-new test.f90

I get errors in the output as follows:

error: loc("./test.f90":1:1): 'func.func' op attribute 'arg_attrs' failed to sat
isfy constraint: Array of dictionary attributes
error: Lowering to LLVM IR failed
error: loc("./test.f90":1:1): cannot be converted to LLVM IR: missing `LLVMTrans
lationDialectInterface` registration for dialect for op: func.func
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and i
nclude the crash backtrace.
Stack dump:
0.      Program arguments: /local/home/psteinfeld/up/build/bin/flang-new -fc1 -t
riple x86_64-unknown-linux-gnu -emit-obj -mrelocation-model pic -pic-level 2 -pi
c-is-pie -target-cpu x86-64 -o /tmp/test-b5f848.o -x f95-cpp-input test.f90
 #0 0x0000000003337f38 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/loc
al/home/psteinfeld/up/build/bin/flang-new+0x3337f38)
 #1 0x000000000333588c SignalHandler(int) Signals.cpp:0:0
 #2 0x0000151bf3bcdc20 __restore_rt sigaction.c:0:0
 #3 0x0000000006a17f8b llvm::Module::setPICLevel(llvm::PICLevel::Level) (/local/
home/psteinfeld/up/build/bin/flang-new+0x6a17f8b)
 #4 0x000000000390308c Fortran::frontend::CodeGenAction::generateLLVMIR() (/loca
l/home/psteinfeld/up/build/bin/flang-new+0x390308c)
   ...

@DavidSpickett
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have reverted this and the original change in f3379fe.

Probably best to centralise the discussion onto https://reviews.llvm.org/D139472.

#3 0x0000000006a17f8b llvm::Module::setPICLevel(llvm::PICLevel::Level) (/local/
home/psteinfeld/up/build/bin/flang-new+0x6a17f8b)

We saw the same thing on the bots so with this revert, that should be fixed.

@psteinfeld
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @DavidSpickett. This helps me considerably.

Please sign in to comment.