Skip to content

Commit 4948b88

Browse files
committed
Handled review comments.
Following changes were done. 1. Remove MLIR changes as they have been moved to separate PR. 2. Replace std::map with llvm::StringMap 3. Use a direct for loop instead of module.walk.
1 parent f576c34 commit 4948b88

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

flang/lib/Optimizer/Transforms/AddDebugInfo.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class AddDebugInfoPass : public fir::impl::AddDebugInfoBase<AddDebugInfoPass> {
5151
void runOnOperation() override;
5252

5353
private:
54-
std::map<std::string, mlir::LLVM::DIModuleAttr> moduleMap;
54+
llvm::StringMap<mlir::LLVM::DIModuleAttr> moduleMap;
5555

5656
mlir::LLVM::DIModuleAttr getOrCreateModuleAttr(
5757
const std::string &name, mlir::LLVM::DIFileAttr fileAttr,
@@ -79,7 +79,7 @@ mlir::LLVM::DIModuleAttr AddDebugInfoPass::getOrCreateModuleAttr(
7979
mlir::MLIRContext *context = &getContext();
8080
mlir::LLVM::DIModuleAttr modAttr;
8181
if (auto iter{moduleMap.find(name)}; iter != moduleMap.end())
82-
modAttr = iter->second;
82+
modAttr = iter->getValue();
8383
else {
8484
modAttr = mlir::LLVM::DIModuleAttr::get(
8585
context, fileAttr, scope, mlir::StringAttr::get(context, name),
@@ -169,9 +169,8 @@ void AddDebugInfoPass::runOnOperation() {
169169
llvm::dwarf::getLanguage("DW_LANG_Fortran95"), fileAttr, producer,
170170
isOptimized, debugLevel);
171171

172-
module.walk([&](fir::GlobalOp globalOp) {
172+
for (auto globalOp : module.getOps<fir::GlobalOp>())
173173
handleGlobalOp(globalOp, fileAttr, cuAttr);
174-
});
175174

176175
module.walk([&](mlir::func::FuncOp funcOp) {
177176
mlir::Location l = funcOp->getLoc();

0 commit comments

Comments
 (0)