mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 04:02:44 +00:00 
			
		
		
		
	LibJS: Fix MergeBlocks emitting some blocks twice
This commit is contained in:
		
							parent
							
								
									28e2467b48
								
							
						
					
					
						commit
						c66284ab0b
					
				
					 1 changed files with 15 additions and 8 deletions
				
			
		|  | @ -109,14 +109,21 @@ void MergeBlocks::perform(PassPipelineExecutable& executable) | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         auto blocks_to_merge_copy = blocks_to_merge; |         auto blocks_to_merge_copy = blocks_to_merge; | ||||||
|         for (auto& last : blocks_to_merge) { |         // We need to do the following multiple times, due to it not being
 | ||||||
|             auto entry = cfg.find(last); |         // guaranteed, that the blocks are in sequential order
 | ||||||
|             if (entry == cfg.end()) |         bool did_prepend = true; | ||||||
|                 continue; |         while (did_prepend) { | ||||||
|             auto successor = *entry->value.begin(); |             did_prepend = false; | ||||||
|             if (auto it = successors.find(successor); !it.is_end()) { |             for (auto const* last : blocks_to_merge) { | ||||||
|                 successors.insert(it.index(), last); |                 auto entry = cfg.find(last); | ||||||
|                 blocks_to_merge_copy.remove(last); |                 if (entry == cfg.end()) | ||||||
|  |                     continue; | ||||||
|  |                 auto const* successor = *entry->value.begin(); | ||||||
|  |                 if (successor == successors.first()) { | ||||||
|  |                     successors.prepend(last); | ||||||
|  |                     blocks_to_merge_copy.remove(last); | ||||||
|  |                     did_prepend = true; | ||||||
|  |                 } | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Hendiadyoin1
						Hendiadyoin1