@@ -240,67 +240,6 @@ bool getEffectsAfter(Operation *op,
240240 return !conservative;
241241}
242242
243- bool isReadOnly (Operation *op) {
244- bool hasRecursiveEffects = op->hasTrait <OpTrait::HasRecursiveMemoryEffects>();
245- if (hasRecursiveEffects) {
246- for (Region ®ion : op->getRegions ()) {
247- for (auto &block : region) {
248- for (auto &nestedOp : block)
249- if (!isReadOnly (&nestedOp))
250- return false ;
251- }
252- }
253- return true ;
254- }
255-
256- // If the op has memory effects, try to characterize them to see if the op
257- // is trivially dead here.
258- if (auto effectInterface = dyn_cast<MemoryEffectOpInterface>(op)) {
259- // Check to see if this op either has no effects, or only allocates/reads
260- // memory.
261- SmallVector<MemoryEffects::EffectInstance, 1 > effects;
262- effectInterface.getEffects (effects);
263- if (!llvm::all_of (effects, [](const MemoryEffects::EffectInstance &it) {
264- return isa<MemoryEffects::Read>(it.getEffect ());
265- })) {
266- return false ;
267- }
268- return true ;
269- }
270- return false ;
271- }
272-
273- bool isReadNone (Operation *op) {
274- bool hasRecursiveEffects = op->hasTrait <OpTrait::HasRecursiveMemoryEffects>();
275- if (hasRecursiveEffects) {
276- for (Region ®ion : op->getRegions ()) {
277- for (auto &block : region) {
278- for (auto &nestedOp : block)
279- if (!isReadNone (&nestedOp))
280- return false ;
281- }
282- }
283- return true ;
284- }
285-
286- // If the op has memory effects, try to characterize them to see if the op
287- // is trivially dead here.
288- if (auto effectInterface = dyn_cast<MemoryEffectOpInterface>(op)) {
289- // Check to see if this op either has no effects, or only allocates/reads
290- // memory.
291- SmallVector<MemoryEffects::EffectInstance, 1 > effects;
292- effectInterface.getEffects (effects);
293- if (llvm::any_of (effects, [](const MemoryEffects::EffectInstance &it) {
294- return isa<MemoryEffects::Read>(it.getEffect ()) ||
295- isa<MemoryEffects::Write>(it.getEffect ());
296- })) {
297- return false ;
298- }
299- return true ;
300- }
301- return false ;
302- }
303-
304243const std::set<std::string> &getNonCapturingFunctions () {
305244 static std::set<std::string> NonCapturingFunctions = {
306245 " free" , " printf" , " fprintf" , " scanf" ,
0 commit comments