Cannot build Flang with latest LLVM

Hi,

I just did an llvm build from source and here’s what I hit. I am trying to build projects “mlir;clang;openmp;flang”.

Steps Followed:

  • git clone https://github.com/llvm/llvm-project.git

  • cmake -DLLVM_ENABLE_PROJECTS=“mlir;clang;openmp;flang” -DCMAKE_C_COMPILER=/usr/local/bin/gcc -DCMAKE_CXX_COMPILER=/usr/local/bin/g++ -G “Unix Makefiles” -DLLVM_USE_LINKER=gold -DCMAKE_BUILD_TYPE=Debug …/llvm/

  • make

[root@localhost build]# /usr/local/bin/g++ -v
Using built-in specs.
COLLECT_GCC=/usr/local/bin/g++
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/7.3.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ./configure --disable-multilib --enable-languages=c,c++,fortran
Thread model: posix
gcc version 7.3.0 (GCC)
[root@localhost build]# /usr/local/bin/gcc -v
Using built-in specs.
COLLECT_GCC=/usr/local/bin/gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/7.3.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ./configure --disable-multilib --enable-languages=c,c++,fortran
Thread model: posix
gcc version 7.3.0 (GCC)
[root@localhost build]#

Scanning dependencies of target MLIRAnalysis

[ 71%] Building CXX object tools/mlir/lib/Analysis/CMakeFiles/MLIRAnalysis.dir/CallGraph.cpp.o
[ 71%] Building CXX object tools/mlir/lib/Analysis/CMakeFiles/MLIRAnalysis.dir/Liveness.cpp.o
[ 71%] Building CXX object tools/mlir/lib/Analysis/CMakeFiles/MLIRAnalysis.dir/SliceAnalysis.cpp.o
[ 71%] Building CXX object tools/mlir/lib/Analysis/CMakeFiles/MLIRAnalysis.dir/Dominance.cpp.o
In file included from /root/LLVM/llvm-project-new/llvm-project/llvm/include/llvm/ADT/STLExtras.h:20:0,
from /root/LLVM/llvm-project-new/llvm-project/mlir/include/mlir/Support/STLExtras.h:18,
from /root/LLVM/llvm-project-new/llvm-project/mlir/include/mlir/IR/StorageUniquerSupport.h:17,
from /root/LLVM/llvm-project-new/llvm-project/mlir/include/mlir/IR/TypeSupport.h:17,
from /root/LLVM/llvm-project-new/llvm-project/mlir/include/mlir/IR/Types.h:12,
from /root/LLVM/llvm-project-new/llvm-project/mlir/include/mlir/IR/Value.h:16,
from /root/LLVM/llvm-project-new/llvm-project/mlir/include/mlir/IR/BlockSupport.h:16,
from /root/LLVM/llvm-project-new/llvm-project/mlir/include/mlir/IR/Block.h:16,
from /root/LLVM/llvm-project-new/llvm-project/mlir/include/mlir/IR/Region.h:16,
from /root/LLVM/llvm-project-new/llvm-project/mlir/include/mlir/IR/RegionGraphTraits.h:18,
from /root/LLVM/llvm-project-new/llvm-project/mlir/include/mlir/Analysis/Dominance.h:12,
from /root/LLVM/llvm-project-new/llvm-project/mlir/lib/Analysis/Dominance.cpp:14:
/root/LLVM/llvm-project-new/llvm-project/llvm/include/llvm/ADT/iterator.h: In instantiation of ‘NodeRef& llvm::WrappedPairNodeDataIterator<ItType, NodeRef, DataRef>::operator*() const [with ItType = mlir::PredecessorIterator; NodeRef = std::pair<const llvm::GraphDiff<mlir::Block*, true>, mlir::Block>; DataRef = const llvm::GraphDiff<mlir::Block*, true>]’:
/root/LLVM/llvm-project-new/llvm-project/llvm/include/llvm/ADT/STLExtras.h:315:36: required from ‘void llvm::filter_iterator_base<WrappedIteratorT, PredicateT, IterTag>::findNextValid() [with WrappedIteratorT = llvm::WrappedPairNodeDataIterator<mlir::PredecessorIterator, std::pair<const llvm::GraphDiff<mlir::Block
, true>, mlir::Block>, const llvm::GraphDiff<mlir::Block*, true>>; PredicateT = llvm::CFGViewChildren<GraphT, InverseGraph, InverseEdge, GT>::children(llvm::CFGViewChildren<GraphT, InverseGraph, InverseEdge, GT>::NodeRef) [with GraphT = llvm::Inversemlir::Block*; bool InverseGraph = true; bool InverseEdge = true; GT = llvm::GraphTraits<llvm::Inversemlir::Block* >; llvm::CFGViewChildren<GraphT, InverseGraph, InverseEdge, GT>::NodeRef = std::pair<const llvm::GraphDiff<mlir::Block, true>, mlir::Block>; typename GT::NodeRef = mlir::Block*]::<lambda(llvm::CFGViewChildren<llvm::Inversemlir::Block*, true, true, llvm::GraphTraits<llvm::Inversemlir::Block* > >::NodeRef)>; IterTag = std::forward_iterator_tag]’
/root/LLVM/llvm-project-new/llvm-project/llvm/include/llvm/ADT/STLExtras.h:325:18: required from ‘llvm::filter_iterator_base<WrappedIteratorT, PredicateT, IterTag>::filter_iterator_base(WrappedIteratorT, WrappedIteratorT, PredicateT) [with WrappedIteratorT = llvm::WrappedPairNodeDataIterator<mlir::PredecessorIterator, std::pair<const llvm::GraphDiff<mlir::Block*, true>, mlir::Block>, const llvm::GraphDiff<mlir::Block*, true>>; PredicateT = llvm::CFGViewChildren<GraphT, InverseGraph, InverseEdge, GT>::children(llvm::CFGViewChildren<GraphT, InverseGraph, InverseEdge, GT>::NodeRef) [with GraphT = llvm::Inversemlir::Block*; bool InverseGraph = true; bool InverseEdge = true; GT = llvm::GraphTraits<llvm::Inversemlir::Block* >; llvm::CFGViewChildren<GraphT, InverseGraph, InverseEdge, GT>::NodeRef = std::pair<const llvm::GraphDiff<mlir::Block, true>, mlir::Block>; typename GT::NodeRef = mlir::Block*]::<lambda(llvm::CFGViewChildren<llvm::Inversemlir::Block*, true, true, llvm::GraphTraits<llvm::Inversemlir::Block* > >::NodeRef)>; IterTag = std::forward_iterator_tag]’
/root/LLVM/llvm-project-new/llvm-project/llvm/include/llvm/ADT/STLExtras.h:348:31: required from ‘llvm::filter_iterator_impl<WrappedIteratorT, PredicateT, IterTag>::filter_iterator_impl(WrappedIteratorT, WrappedIteratorT, PredicateT) [with WrappedIteratorT = llvm::WrappedPairNodeDataIterator<mlir::PredecessorIterator, std::pair<const llvm::GraphDiff<mlir::Block*, true>, mlir::Block>, const llvm::GraphDiff<mlir::Block*, true>>; PredicateT = llvm::CFGViewChildren<GraphT, InverseGraph, InverseEdge, GT>::children(llvm::CFGViewChildren<GraphT, InverseGraph, InverseEdge, GT>::NodeRef) [with GraphT = llvm::Inversemlir::Block*; bool InverseGraph = true; bool InverseEdge = true; GT = llvm::GraphTraits<llvm::Inversemlir::Block* >; llvm::CFGViewChildren<GraphT, InverseGraph, InverseEdge, GT>::NodeRef = std::pair<const llvm::GraphDiff<mlir::Block, true>, mlir::Block>; typename GT::NodeRef = mlir::Block*]::<lambda(llvm::CFGViewChildren<llvm::Inversemlir::Block*, true, true, llvm::GraphTraits<llvm::Inversemlir::Block* > >::NodeRef)>; IterTag = std::forward_iterator_tag]’
/root/LLVM/llvm-project-new/llvm-project/llvm/include/llvm/ADT/STLExtras.h:419:7: required from ‘llvm::iterator_range<llvm::filter_iterator_impl<decltype (std::begin(declval<RangeT&>())), PredicateT, typename llvm::detail::fwd_or_bidi_tag<decltype (std::begin(declval<RangeT&>()))>::type> > llvm::make_filter_range(RangeT&&, PredicateT) [with RangeT = llvm::iterator_range<llvm::WrappedPairNodeDataIterator<mlir::PredecessorIterator, std::pair<const llvm::GraphDiff<mlir::Block*, true>, mlir::Block>, const llvm::GraphDiff<mlir::Block*, true>> >; PredicateT = llvm::CFGViewChildren<GraphT, InverseGraph, InverseEdge, GT>::children(llvm::CFGViewChildren<GraphT, InverseGraph, InverseEdge, GT>::NodeRef) [with GraphT = llvm::Inversemlir::Block*; bool InverseGraph = true; bool InverseEdge = true; GT = llvm::GraphTraits<llvm::Inversemlir::Block* >; llvm::CFGViewChildren<GraphT, InverseGraph, InverseEdge, GT>::NodeRef = std::pair<const llvm::GraphDiff<mlir::Block, true>, mlir::Block>; typename GT::NodeRef = mlir::Block*]::<lambda(llvm::CFGViewChildren<llvm::Inversemlir::Block*, true, true, llvm::GraphTraits<llvm::Inversemlir::Block* > >::NodeRef)>; typename llvm::detail::fwd_or_bidi_tag<decltype (std::begin(declval<RangeT&>()))>::type = std::forward_iterator_tag; decltype (std::begin(declval<RangeT&>())) = llvm::WrappedPairNodeDataIterator<mlir::PredecessorIterator, std::pair<const llvm::GraphDiff<mlir::Block*, true>, mlir::Block>, const llvm::GraphDiff<mlir::Block*, true>>]’
/root/LLVM/llvm-project-new/llvm-project/llvm/include/llvm/IR/CFGDiff.h:234:35: required from ‘static auto llvm::CFGViewChildren<GraphT, InverseGraph, InverseEdge, GT>::children(llvm::CFGViewChildren<GraphT, InverseGraph, InverseEdge, GT>::NodeRef) [with GraphT = llvm::Inversemlir::Block*; bool InverseGraph = true; bool InverseEdge = true; GT = llvm::GraphTraits<llvm::Inversemlir::Block* >; llvm::CFGViewChildren<GraphT, InverseGraph, InverseEdge, GT>::NodeRef = std::pair<const llvm::GraphDiff<mlir::Block
, true>, mlir::Block>; typename GT::NodeRef = mlir::Block*]’
/root/LLVM/llvm-project-new/llvm-project/llvm/include/llvm/IR/CFGDiff.h:255:20: [ skipping 4 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/root/LLVM/llvm-project-new/llvm-project/llvm/include/llvm/Support/GenericDomTreeConstruction.h:885:59: required from ‘llvm::DomTreeBuilder::SemiNCAInfo::DeleteEdge(DomTreeT&, llvm::DomTreeBuilder::SemiNCAInfo::BatchUpdatePtr, llvm::DomTreeBuilder::SemiNCAInfo::NodePtr, llvm::DomTreeBuilder::SemiNCAInfo::NodePtr)::<lambda(llvm::DomTreeBuilder::SemiNCAInfo::NodePtr, llvm::DomTreeBuilder::SemiNCAInfo::NodePtr)> [with DomTreeT = llvm::DominatorTreeBase<mlir::Block, true>; llvm::DomTreeBuilder::SemiNCAInfo::NodePtr = mlir::Block*]’
/root/LLVM/llvm-project-new/llvm-project/llvm/include/llvm/Support/GenericDomTreeConstruction.h:882:25: required from ‘struct llvm::DomTreeBuilder::SemiNCAInfo::DeleteEdge(DomTreeT&, llvm::DomTreeBuilder::SemiNCAInfo::BatchUpdatePtr, llvm::DomTreeBuilder::SemiNCAInfo::NodePtr, llvm::DomTreeBuilder::SemiNCAInfo::NodePtr) [with DomTreeT = llvm::DominatorTreeBase<mlir::Block, true>; llvm::DomTreeBuilder::SemiNCAInfo::BatchUpdatePtr = llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<mlir::Block, true> >::BatchUpdateInfo*; llvm::DomTreeBuilder::SemiNCAInfo::NodePtr = mlir::Block*]::<lambda(using NodePtr = using NodePtr = class mlir::Block*, using NodePtr = using NodePtr = class mlir::Block*)>’
/root/LLVM/llvm-project-new/llvm-project/llvm/include/llvm/Support/GenericDomTreeConstruction.h:882:10: required from ‘static void llvm::DomTreeBuilder::SemiNCAInfo::DeleteEdge(DomTreeT&, llvm::DomTreeBuilder::SemiNCAInfo::BatchUpdatePtr, llvm::DomTreeBuilder::SemiNCAInfo::NodePtr, llvm::DomTreeBuilder::SemiNCAInfo::NodePtr) [with DomTreeT = llvm::DominatorTreeBase<mlir::Block, true>; llvm::DomTreeBuilder::SemiNCAInfo::BatchUpdatePtr = llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<mlir::Block, true> >::BatchUpdateInfo*; llvm::DomTreeBuilder::SemiNCAInfo::NodePtr = mlir::Block*]’
/root/LLVM/llvm-project-new/llvm-project/llvm/include/llvm/Support/GenericDomTreeConstruction.h:1540:36: required from ‘void llvm::DomTreeBuilder::DeleteEdge(DomTreeT&, typename DomTreeT::NodePtr, typename DomTreeT::NodePtr) [with DomTreeT = llvm::DominatorTreeBase<mlir::Block, true>; typename DomTreeT::NodePtr = mlir::Block*]’
/root/LLVM/llvm-project-new/llvm-project/llvm/include/llvm/Support/GenericDomTree.h:561:31: required from ‘void llvm::DominatorTreeBase<NodeT, IsPostDom>::deleteEdge(NodeT*, NodeT*) [with NodeT = mlir::Block; bool IsPostDom = true]’
/root/LLVM/llvm-project-new/llvm-project/mlir/lib/Analysis/Dominance.cpp:23:22: required from here
/root/LLVM/llvm-project-new/llvm-project/llvm/include/llvm/ADT/iterator.h:366:17: error: passing ‘const mlir::PredecessorIterator’ as ‘this’ argument discards qualifiers [-fpermissive]
NR.second = *this->I;
^~~~~~~~
In file included from /root/LLVM/llvm-project-new/llvm-project/mlir/include/mlir/Support/STLExtras.h:18:0,
from /root/LLVM/llvm-project-new/llvm-project/mlir/include/mlir/IR/StorageUniquerSupport.h:17,
from /root/LLVM/llvm-project-new/llvm-project/mlir/include/mlir/IR/TypeSupport.h:17,
from /root/LLVM/llvm-project-new/llvm-project/mlir/include/mlir/IR/Types.h:12,
from /root/LLVM/llvm-project-new/llvm-project/mlir/include/mlir/IR/Value.h:16,
from /root/LLVM/llvm-project-new/llvm-project/mlir/include/mlir/IR/BlockSupport.h:16,
from /root/LLVM/llvm-project-new/llvm-project/mlir/include/mlir/IR/Block.h:16,
from /root/LLVM/llvm-project-new/llvm-project/mlir/include/mlir/IR/Region.h:16,
from /root/LLVM/llvm-project-new/llvm-project/mlir/include/mlir/IR/RegionGraphTraits.h:18,
from /root/LLVM/llvm-project-new/llvm-project/mlir/include/mlir/Analysis/Dominance.h:12,
from /root/LLVM/llvm-project-new/llvm-project/mlir/lib/Analysis/Dominance.cpp:14:
/root/LLVM/llvm-project-new/llvm-project/llvm/include/llvm/ADT/STLExtras.h:217:16: note: in call to ‘FuncReturnTy llvm::mapped_iterator<ItTy, FuncTy, FuncReturnTy>::operator*() [with ItTy = mlir::ValueUseIteratormlir::BlockOperand; FuncTy = mlir::Block* ()(mlir::BlockOperand&); FuncReturnTy = mlir::Block]’
FuncReturnTy operator*() { return F(*this->I); }
^~~~~~~~
In file included from /root/LLVM/llvm-project-new/llvm-project/llvm/include/llvm/ADT/STLExtras.h:20:0,
from /root/LLVM/llvm-project-new/llvm-project/mlir/include/mlir/Support/STLExtras.h:18,
from /root/LLVM/llvm-project-new/llvm-project/mlir/include/mlir/IR/StorageUniquerSupport.h:17,
from /root/LLVM/llvm-project-new/llvm-project/mlir/include/mlir/IR/TypeSupport.h:17,
from /root/LLVM/llvm-project-new/llvm-project/mlir/include/mlir/IR/Types.h:12,
from /root/LLVM/llvm-project-new/llvm-project/mlir/include/mlir/IR/Value.h:16,
from /root/LLVM/llvm-project-new/llvm-project/mlir/include/mlir/IR/BlockSupport.h:16,
from /root/LLVM/llvm-project-new/llvm-project/mlir/include/mlir/IR/Block.h:16,
from /root/LLVM/llvm-project-new/llvm-project/mlir/include/mlir/IR/Region.h:16,
from /root/LLVM/llvm-project-new/llvm-project/mlir/include/mlir/IR/RegionGraphTraits.h:18,
from /root/LLVM/llvm-project-new/llvm-project/mlir/include/mlir/Analysis/Dominance.h:12,
from /root/LLVM/llvm-project-new/llvm-project/mlir/lib/Analysis/Dominance.cpp:14:
/root/LLVM/llvm-project-new/llvm-project/llvm/include/llvm/ADT/iterator.h: In instantiation of ‘NodeRef& llvm::WrappedPairNodeDataIterator<ItType, NodeRef, DataRef>::operator*() const [with ItType = mlir::PredecessorIterator; NodeRef = std::pair<const llvm::GraphDiff<mlir::Block*, false>, mlir::Block>; DataRef = const llvm::GraphDiff<mlir::Block*, false>]’:
/root/LLVM/llvm-project-new/llvm-project/llvm/include/llvm/ADT/STLExtras.h:315:36: required from ‘void llvm::filter_iterator_base<WrappedIteratorT, PredicateT, IterTag>::findNextValid() [with WrappedIteratorT = llvm::WrappedPairNodeDataIterator<mlir::PredecessorIterator, std::pair<const llvm::GraphDiff<mlir::Block
, false>, mlir::Block>, const llvm::GraphDiff<mlir::Block*, false>>; PredicateT = llvm::CFGViewChildren<GraphT, InverseGraph, InverseEdge, GT>::children(llvm::CFGViewChildren<GraphT, InverseGraph, InverseEdge, GT>::NodeRef) [with GraphT = llvm::Inversemlir::Block*; bool InverseGraph = false; bool InverseEdge = true; GT = llvm::GraphTraits<llvm::Inversemlir::Block* >; llvm::CFGViewChildren<GraphT, InverseGraph, InverseEdge, GT>::NodeRef = std::pair<const llvm::GraphDiff<mlir::Block, false>, mlir::Block>; typename GT::NodeRef = mlir::Block*]::<lambda(llvm::CFGViewChildren<llvm::Inversemlir::Block*, false, true, llvm::GraphTraits<llvm::Inversemlir::Block* > >::NodeRef)>; IterTag = std::forward_iterator_tag]’
/root/LLVM/llvm-project-new/llvm-project/llvm/include/llvm/ADT/STLExtras.h:325:18: required from ‘llvm::filter_iterator_base<WrappedIteratorT, PredicateT, IterTag>::filter_iterator_base(WrappedIteratorT, WrappedIteratorT, PredicateT) [with WrappedIteratorT = llvm::WrappedPairNodeDataIterator<mlir::PredecessorIterator, std::pair<const llvm::GraphDiff<mlir::Block*, false>, mlir::Block>, const llvm::GraphDiff<mlir::Block*, false>>; PredicateT = llvm::CFGViewChildren<GraphT, InverseGraph, InverseEdge, GT>::children(llvm::CFGViewChildren<GraphT, InverseGraph, InverseEdge, GT>::NodeRef) [with GraphT = llvm::Inversemlir::Block*; bool InverseGraph = false; bool InverseEdge = true; GT = llvm::GraphTraits<llvm::Inversemlir::Block* >; llvm::CFGViewChildren<GraphT, InverseGraph, InverseEdge, GT>::NodeRef = std::pair<const llvm::GraphDiff<mlir::Block, false>, mlir::Block>; typename GT::NodeRef = mlir::Block*]::<lambda(llvm::CFGViewChildren<llvm::Inversemlir::Block*, false, true, llvm::GraphTraits<llvm::Inversemlir::Block* > >::NodeRef)>; IterTag = std::forward_iterator_tag]’
/root/LLVM/llvm-project-new/llvm-project/llvm/include/llvm/ADT/STLExtras.h:348:31: required from ‘llvm::filter_iterator_impl<WrappedIteratorT, PredicateT, IterTag>::filter_iterator_impl(WrappedIteratorT, WrappedIteratorT, PredicateT) [with WrappedIteratorT = llvm::WrappedPairNodeDataIterator<mlir::PredecessorIterator, std::pair<const llvm::GraphDiff<mlir::Block*, false>, mlir::Block>, const llvm::GraphDiff<mlir::Block*, false>>; PredicateT = llvm::CFGViewChildren<GraphT, InverseGraph, InverseEdge, GT>::children(llvm::CFGViewChildren<GraphT, InverseGraph, InverseEdge, GT>::NodeRef) [with GraphT = llvm::Inversemlir::Block*; bool InverseGraph = false; bool InverseEdge = true; GT = llvm::GraphTraits<llvm::Inversemlir::Block* >; llvm::CFGViewChildren<GraphT, InverseGraph, InverseEdge, GT>::NodeRef = std::pair<const llvm::GraphDiff<mlir::Block, false>, mlir::Block>; typename GT::NodeRef = mlir::Block*]::<lambda(llvm::CFGViewChildren<llvm::Inversemlir::Block*, false, true, llvm::GraphTraits<llvm::Inversemlir::Block* > >::NodeRef)>; IterTag = std::forward_iterator_tag]’
/root/LLVM/llvm-project-new/llvm-project/llvm/include/llvm/ADT/STLExtras.h:419:7: required from ‘llvm::iterator_range<llvm::filter_iterator_impl<decltype (std::begin(declval<RangeT&>())), PredicateT, typename llvm::detail::fwd_or_bidi_tag<decltype (std::begin(declval<RangeT&>()))>::type> > llvm::make_filter_range(RangeT&&, PredicateT) [with RangeT = llvm::iterator_range<llvm::WrappedPairNodeDataIterator<mlir::PredecessorIterator, std::pair<const llvm::GraphDiff<mlir::Block*, false>, mlir::Block>, const llvm::GraphDiff<mlir::Block*, false>> >; PredicateT = llvm::CFGViewChildren<GraphT, InverseGraph, InverseEdge, GT>::children(llvm::CFGViewChildren<GraphT, InverseGraph, InverseEdge, GT>::NodeRef) [with GraphT = llvm::Inversemlir::Block*; bool InverseGraph = false; bool InverseEdge = true; GT = llvm::GraphTraits<llvm::Inversemlir::Block* >; llvm::CFGViewChildren<GraphT, InverseGraph, InverseEdge, GT>::NodeRef = std::pair<const llvm::GraphDiff<mlir::Block, false>, mlir::Block>; typename GT::NodeRef = mlir::Block*]::<lambda(llvm::CFGViewChildren<llvm::Inversemlir::Block*, false, true, llvm::GraphTraits<llvm::Inversemlir::Block* > >::NodeRef)>; typename llvm::detail::fwd_or_bidi_tag<decltype (std::begin(declval<RangeT&>()))>::type = std::forward_iterator_tag; decltype (std::begin(declval<RangeT&>())) = llvm::WrappedPairNodeDataIterator<mlir::PredecessorIterator, std::pair<const llvm::GraphDiff<mlir::Block*, false>, mlir::Block>, const llvm::GraphDiff<mlir::Block*, false>>]’
/root/LLVM/llvm-project-new/llvm-project/llvm/include/llvm/IR/CFGDiff.h:234:35: required from ‘static auto llvm::CFGViewChildren<GraphT, InverseGraph, InverseEdge, GT>::children(llvm::CFGViewChildren<GraphT, InverseGraph, InverseEdge, GT>::NodeRef) [with GraphT = llvm::Inversemlir::Block*; bool InverseGraph = false; bool InverseEdge = true; GT = llvm::GraphTraits<llvm::Inversemlir::Block* >; llvm::CFGViewChildren<GraphT, InverseGraph, InverseEdge, GT>::NodeRef = std::pair<const llvm::GraphDiff<mlir::Block
, false>, mlir::Block>; typename GT::NodeRef = mlir::Block*]’
/root/LLVM/llvm-project-new/llvm-project/llvm/include/llvm/IR/CFGDiff.h:255:20: [ skipping 3 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/root/LLVM/llvm-project-new/llvm-project/llvm/include/llvm/ADT/GraphTraits.h:121:1: required by substitution of ‘template llvm::iterator_range<typename llvm::GraphTraits::ChildIteratorType> llvm::children(const typename llvm::GraphTraits::NodeRef&) [with GraphType = std::pair<const llvm::GraphDiff<mlir::Block*, false>, llvm::Inversemlir::Block* >]’
/root/LLVM/llvm-project-new/llvm-project/llvm/include/llvm/Support/GenericDomTreeConstruction.h:977:56: required from ‘static bool llvm::DomTreeBuilder::SemiNCAInfo::HasProperSupport(DomTreeT&, llvm::DomTreeBuilder::SemiNCAInfo::BatchUpdatePtr, llvm::DomTreeBuilder::SemiNCAInfo::TreeNodePtr) [with DomTreeT = llvm::DominatorTreeBase<mlir::Block, false>; llvm::DomTreeBuilder::SemiNCAInfo::BatchUpdatePtr = llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<mlir::Block, false> >::BatchUpdateInfo
; llvm::DomTreeBuilder::SemiNCAInfo::TreeNodePtr = llvm::DomTreeNodeBasemlir::Block; typename DomTreeT::NodeType = mlir::Block]’
/root/LLVM/llvm-project-new/llvm-project/llvm/include/llvm/Support/GenericDomTreeConstruction.h:919:47: required from ‘static void llvm::DomTreeBuilder::SemiNCAInfo::DeleteEdge(DomTreeT&, llvm::DomTreeBuilder::SemiNCAInfo::BatchUpdatePtr, llvm::DomTreeBuilder::SemiNCAInfo::NodePtr, llvm::DomTreeBuilder::SemiNCAInfo::NodePtr) [with DomTreeT = llvm::DominatorTreeBase<mlir::Block, false>; llvm::DomTreeBuilder::SemiNCAInfo::BatchUpdatePtr = llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<mlir::Block, false> >::BatchUpdateInfo
; llvm::DomTreeBuilder::SemiNCAInfo::NodePtr = mlir::Block*]’
/root/LLVM/llvm-project-new/llvm-project/llvm/include/llvm/Support/GenericDomTreeConstruction.h:1540:36: required from ‘void llvm::DomTreeBuilder::DeleteEdge(DomTreeT&, typename DomTreeT::NodePtr, typename DomTreeT::NodePtr) [with DomTreeT = llvm::DominatorTreeBase<mlir::Block, false>; typename DomTreeT::NodePtr = mlir::Block*]’
/root/LLVM/llvm-project-new/llvm-project/llvm/include/llvm/Support/GenericDomTree.h:561:31: required from ‘void llvm::DominatorTreeBase<NodeT, IsPostDom>::deleteEdge(NodeT*, NodeT*) [with NodeT = mlir::Block; bool IsPostDom = false]’
/root/LLVM/llvm-project-new/llvm-project/mlir/lib/Analysis/Dominance.cpp:22:22: required from here
/root/LLVM/llvm-project-new/llvm-project/llvm/include/llvm/ADT/iterator.h:366:17: error: passing ‘const mlir::PredecessorIterator’ as ‘this’ argument discards qualifiers [-fpermissive]
NR.second = *this->I;
^~~~~~~~
In file included from /root/LLVM/llvm-project-new/llvm-project/mlir/include/mlir/Support/STLExtras.h:18:0,
from /root/LLVM/llvm-project-new/llvm-project/mlir/include/mlir/IR/StorageUniquerSupport.h:17,
from /root/LLVM/llvm-project-new/llvm-project/mlir/include/mlir/IR/TypeSupport.h:17,
from /root/LLVM/llvm-project-new/llvm-project/mlir/include/mlir/IR/Types.h:12,
from /root/LLVM/llvm-project-new/llvm-project/mlir/include/mlir/IR/Value.h:16,
from /root/LLVM/llvm-project-new/llvm-project/mlir/include/mlir/IR/BlockSupport.h:16,
from /root/LLVM/llvm-project-new/llvm-project/mlir/include/mlir/IR/Block.h:16,
from /root/LLVM/llvm-project-new/llvm-project/mlir/include/mlir/IR/Region.h:16,
from /root/LLVM/llvm-project-new/llvm-project/mlir/include/mlir/IR/RegionGraphTraits.h:18,
from /root/LLVM/llvm-project-new/llvm-project/mlir/include/mlir/Analysis/Dominance.h:12,
from /root/LLVM/llvm-project-new/llvm-project/mlir/lib/Analysis/Dominance.cpp:14:
/root/LLVM/llvm-project-new/llvm-project/llvm/include/llvm/ADT/STLExtras.h:217:16: note: in call to ‘FuncReturnTy llvm::mapped_iterator<ItTy, FuncTy, FuncReturnTy>::operator*() [with ItTy = mlir::ValueUseIteratormlir::BlockOperand; FuncTy = mlir::Block* ()(mlir::BlockOperand&); FuncReturnTy = mlir::Block]’
FuncReturnTy operator*() { return F(*this->I); }
^~~~~~~~
make[2]: *** [tools/mlir/lib/Analysis/CMakeFiles/MLIRAnalysis.dir/Dominance.cpp.o] Error 1
make[1]: *** [tools/mlir/lib/Analysis/CMakeFiles/MLIRAnalysis.dir/all] Error 2

TBH, this looks like a MLIR problem to me as all the errors seem to originate from the MLIR subfolder.

Did you try building without flang? If the error persists we need to notify MLIR folks, if not it might

be our cmake.

Cheers,

Johannes

I stripped some text so the list accepts the message:

Can you provide the git hash so that we ensure we are building the same revision?
The problem you mention seems like related to a patch I reverted on Friday.

Hi Mehdi,

I think I downloaded source code on Thursday, I will try build again with latest source code.
Here is my current version where problem is reported:
[root@localhost llvm-project]# git log
commit b647de99254ca047748eded14b9d302912294bec
Author: Heejin Ahn <aheejin@gmail.com>

[WebAssembly] Use dummy debug info in Emscripten SjLj

Summary:
D74269 added debug info to newly created instructions, including calls
to malloc and free, by taking debug info from existing instructions
around, whose debug info may or may not be empty.

But there are cases debug info is required by the IR verifier: when both
the caller and the callee functions have DISubprograms, meaning we
already have declarations to malloc or free with a DISubprogram
attached, newly created calls to malloc and free should have
non-empty debug info. This patch creates a non-empty dummy debug info in
this case to those calls to make the IR verifier pass.

Fixes https://bugs.llvm.org/show_bug.cgi?id=45461.

Reviewers: dschuff

Subscribers: aprantl, sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits

Tags: #llvm

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

Hi,
Thanks , I can build it with latest sources.
I have enable following projects: -DLLVM_ENABLE_PROJECTS=“mlir;clang;openmp;flang”

[root@localhost llvm-project]# git log
commit f3da6b7ab5698bb0b9bd208972115dbcbbc59f27
Author: Brian Cain <brian.cain@gmail.com>