@@ -115,7 +115,8 @@ struct RDVFinalCleanupList {
115115
116116// / Return true iff at least one value in `values` is live, given the liveness
117117// / information in `la`.
118- static bool hasLive (ValueRange values, const DenseSet<Value> &nonLiveSet, const DenseSet<Value> &liveSet,
118+ static bool hasLive (ValueRange values, const DenseSet<Value> &nonLiveSet,
119+ const DenseSet<Value> &liveSet,
119120
120121 RunLivenessAnalysis &la) {
121122 for (Value value : values) {
@@ -263,9 +264,9 @@ static SmallVector<OpOperand *> operandsToOpOperands(OperandRange operands) {
263264// / - Return-like
264265static void processSimpleOp (Operation *op, RunLivenessAnalysis &la,
265266 DenseSet<Value> &nonLiveSet,
266- DenseSet<Value> &liveSet,
267- RDVFinalCleanupList &cl) {
268- if (! isMemoryEffectFree (op) || hasLive (op->getResults (), nonLiveSet, liveSet, la)) {
267+ DenseSet<Value> &liveSet, RDVFinalCleanupList &cl) {
268+ if (! isMemoryEffectFree (op) ||
269+ hasLive (op->getResults (), nonLiveSet, liveSet, la)) {
269270 LDBG () << " Simple op is not memory effect free or has live results, "
270271 " preserving it: "
271272 << OpWithFlags (op, OpPrintingFlags ().skipRegions ());
@@ -384,20 +385,20 @@ static void processFuncOp(FunctionOpInterface funcOp, Operation *module,
384385}
385386
386387static void processCallOp (CallOpInterface callOp, Operation *module ,
387- RunLivenessAnalysis &la,
388- DenseSet<Value> &liveSet) {
388+ RunLivenessAnalysis &la, DenseSet<Value> &liveSet) {
389389 auto callable = callOp.getCallableForCallee ();
390390
391391 if (auto symbolRef = callable.dyn_cast <SymbolRefAttr>()) {
392392 Operation *calleeOp = SymbolTable::lookupSymbolIn (module , symbolRef);
393393
394- if (auto funcOp = llvm::dyn_cast_or_null<mlir::FunctionOpInterface>(calleeOp)) {
394+ if (auto funcOp =
395+ llvm::dyn_cast_or_null<mlir::FunctionOpInterface>(calleeOp)) {
395396 // Ensure the outgoing arguments of PUBLIC functions are live
396397 // because processFuncOp can not process them.
397398 //
398399 // Liveness treats the external function as a blackbox.
399400 if (funcOp.isPublic ()) {
400- for (Value arg: callOp.getArgOperands ()) {
401+ for (Value arg : callOp.getArgOperands ()) {
401402 const Liveness *liveness = la.getLiveness (arg);
402403 if (liveness && !liveness->isLive ) {
403404 liveSet.insert (arg);
@@ -878,7 +879,8 @@ void RemoveDeadValues::runOnOperation() {
878879 if (auto funcOp = dyn_cast<FunctionOpInterface>(op)) {
879880 processFuncOp (funcOp, module , la, deadVals, finalCleanupList);
880881 } else if (auto regionBranchOp = dyn_cast<RegionBranchOpInterface>(op)) {
881- processRegionBranchOp (regionBranchOp, la, deadVals, liveVals, finalCleanupList);
882+ processRegionBranchOp (regionBranchOp, la, deadVals, liveVals,
883+ finalCleanupList);
882884 } else if (auto branchOp = dyn_cast<BranchOpInterface>(op)) {
883885 processBranchOp (branchOp, la, deadVals, finalCleanupList);
884886 } else if (op->hasTrait <::mlir::OpTrait::IsTerminator>()) {
@@ -888,9 +890,9 @@ void RemoveDeadValues::runOnOperation() {
888890 // Nothing to do because this op is associated with a function op and gets
889891 // cleaned when the latter is cleaned.
890892 //
891- // The only exception is public callee. By default, Liveness analysis is inter-procedural.
892- // Unused arguments of a public function nonLive and are propagated to the caller.
893- // processCallOp puts them to liveVals.
893+ // The only exception is public callee. By default, Liveness analysis is
894+ // inter-procedural. Unused arguments of a public function nonLive and are
895+ // propagated to the caller. processCallOp puts them to liveVals.
894896 processCallOp (cast<CallOpInterface>(op), module , la, liveVals);
895897 } else {
896898 processSimpleOp (op, la, deadVals, liveVals, finalCleanupList);
0 commit comments