Skip to content

Commit

Permalink
[NFC][ConversionPatterns] Do not alter locations outside of the signa…
Browse files Browse the repository at this point in the history
…ture conversion

D157882 fixed the problem
  • Loading branch information
nandor committed Nov 29, 2023
1 parent a9f35c2 commit 9d4156a
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions lib/Dialect/HW/ConversionPatterns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,6 @@ LogicalResult circt::doTypeConversion(Operation *op, ValueRange operands,
Region &region = op->getRegion(i);
Region *newRegion = &newOp->getRegion(i);

// TypeConverter::SignatureConversion drops argument locations, so we need
// to manually copy them over (a verifier in e.g. HWModule checks this).
llvm::SmallVector<Location, 4> argLocs;
for (auto arg : region.getArguments())
argLocs.push_back(arg.getLoc());

// Move the region and convert the region args.
rewriter.inlineRegionBefore(region, *newRegion, newRegion->begin());
TypeConverter::SignatureConversion result(newRegion->getNumArguments());
Expand All @@ -92,10 +86,6 @@ LogicalResult circt::doTypeConversion(Operation *op, ValueRange operands,
return rewriter.notifyMatchFailure(op->getLoc(),
"type conversion failed");
rewriter.applySignatureConversion(newRegion, result, typeConverter);

// Apply the argument locations.
for (auto [arg, loc] : llvm::zip(newRegion->getArguments(), argLocs))
arg.setLoc(loc);
}
rewriter.finalizeRootUpdate(newOp);

Expand Down

0 comments on commit 9d4156a

Please sign in to comment.