LoopVectorize: LoopSimplify can't canonicalize loops with an indirectbr in it, don't assert on those cases.
Fixes PR16139. llvm-svn: 182656
This commit is contained in:
		
							parent
							
								
									753d43f974
								
							
						
					
					
						commit
						6ac1e62377
					
				| 
						 | 
					@ -2428,7 +2428,10 @@ bool LoopVectorizationLegality::canVectorizeWithIfConvert() {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool LoopVectorizationLegality::canVectorize() {
 | 
					bool LoopVectorizationLegality::canVectorize() {
 | 
				
			||||||
  assert(TheLoop->getLoopPreheader() && "No preheader!!");
 | 
					  // We must have a loop in canonical form. Loops with indirectbr in them cannot
 | 
				
			||||||
 | 
					  // be canonicalized.
 | 
				
			||||||
 | 
					  if (!TheLoop->getLoopPreheader())
 | 
				
			||||||
 | 
					    return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // We can only vectorize innermost loops.
 | 
					  // We can only vectorize innermost loops.
 | 
				
			||||||
  if (TheLoop->getSubLoopsVector().size())
 | 
					  if (TheLoop->getSubLoopsVector().size())
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -27,3 +27,14 @@ for.end.i.i.i:
 | 
				
			||||||
  unreachable
 | 
					  unreachable
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					; PR16139
 | 
				
			||||||
 | 
					define void @test2(i8* %x) {
 | 
				
			||||||
 | 
					entry:
 | 
				
			||||||
 | 
					  indirectbr i8* %x, [ label %L0, label %L1 ]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					L0:
 | 
				
			||||||
 | 
					  br label %L0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					L1:
 | 
				
			||||||
 | 
					  ret void
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue