ucst.addConstantLowerBound(r, dimSize);
outOfBounds = !ucst.isEmpty();
if (outOfBounds && emitError) {
- loadOrStoreOp.emitOpError(
- "memref out of upper bound access along dimension #" + Twine(r + 1));
+ loadOrStoreOp.emitOpError()
+ << "memref out of upper bound access along dimension #" << (r + 1);
}
// Check for a negative index.
lcst.addConstantUpperBound(r, -1);
outOfBounds = !lcst.isEmpty();
if (outOfBounds && emitError) {
- loadOrStoreOp.emitOpError(
- "memref out of lower bound access along dimension #" + Twine(r + 1));
+ loadOrStoreOp.emitOpError()
+ << "memref out of lower bound access along dimension #" << (r + 1);
}
}
return failure(outOfBounds);
if (domInfo->properlyDominates(operand, &op))
continue;
- auto diag = op.emitError("operand #" + Twine(operandNo) +
- " does not dominate this use");
+ auto diag = op.emitError("operand #")
+ << operandNo << " does not dominate this use";
if (auto *useOp = operand->getDefiningOp())
diag.attachNote(useOp->getLoc()) << "operand defined here";
return failure();
auto results = converter->rewrite(op, operands, builder);
if (results.size() != op->getNumResults())
- return (op->emitError("rewriting produced a different number of results"),
- failure());
+ return op->emitError("rewriting produced a different number of results");
for (unsigned i = 0, e = results.size(); i < e; ++i)
mapping.map(op->getResult(i), results[i]);
return true;
}
-static void emitRemarkForBlock(Block &block, const Twine &message) {
+static InFlightDiagnostic emitRemarkForBlock(Block &block) {
auto *op = block.getContainingOp();
- if (!op) {
- block.getFunction()->emitRemark(message);
- } else {
- op->emitRemark(message);
- }
+ return op ? op->emitRemark() : block.getFunction()->emitRemark();
}
/// Creates a buffer in the faster memory space for the specified region;
fastBufferMap[memref] = fastMemRef;
// fastMemRefType is a constant shaped memref.
*sizeInBytes = getMemRefSizeInBytes(fastMemRefType).getValue();
- LLVM_DEBUG(std::string ss; llvm::raw_string_ostream oss(ss);
- oss << "Creating DMA buffer of type " << fastMemRefType;
- oss << " and size " << llvm::divideCeil(*sizeInBytes, 1024)
- << " KiB\n";
- emitRemarkForBlock(*block, oss.str()));
+ LLVM_DEBUG(emitRemarkForBlock(*block)
+ << "Creating DMA buffer of type " << fastMemRefType
+ << " and size " << llvm::divideCeil(*sizeInBytes, 1024)
+ << " KiB\n");
} else {
// Reuse the one already created.
fastMemRef = fastBufferMap[memref];
AffineForOp forOp;
uint64_t sizeInKib = llvm::divideCeil(totalDmaBuffersSizeInBytes, 1024);
if (llvm::DebugFlag && (forOp = begin->dyn_cast<AffineForOp>())) {
- forOp.emitRemark(
- Twine(sizeInKib) +
- " KiB of DMA buffers in fast memory space for this block\n");
+ forOp.emitRemark()
+ << sizeInKib
+ << " KiB of DMA buffers in fast memory space for this block\n";
}
if (totalDmaBuffersSizeInBytes > fastMemCapacityBytes) {
SmallVector<unsigned, 6> tileSizes;
getTileSizes(band, &tileSizes);
if (llvm::DebugFlag) {
- std::stringstream msg;
- msg << "using tile sizes [";
+ auto diag = band[0].emitRemark("using tile sizes [");
for (auto tSize : tileSizes)
- msg << tSize << " ";
- msg << "]\n";
- auto rootForOp = band[0];
- rootForOp.emitRemark(msg.str());
+ diag << tSize << " ";
+ diag << "]\n";
}
if (failed(tileCodeGen(band, tileSizes)))
return signalPassFailure();