llvm.org GIT mirror llvm / e58867e
jump threading can't split a critical edge from an indirectbr. This fixes PR7356. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105950 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 9 years ago
2 changed file(s) with 28 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
869869
870870 // Add all the unavailable predecessors to the PredsToSplit list.
871871 for (pred_iterator PI = pred_begin(LoadBB), PE = pred_end(LoadBB);
872 PI != PE; ++PI)
872 PI != PE; ++PI) {
873 // If the predecessor is an indirect goto, we can't split the edge.
874 if (isa((*PI)->getTerminator()))
875 return false;
876
873877 if (!AvailablePredSet.count(*PI))
874878 PredsToSplit.push_back(*PI);
879 }
875880
876881 // Split them out to their own block.
877882 UnavailablePred =
340340 ret void
341341 }
342342
343
344
345 ; PR7356
346 define i32 @test13(i32* %P, i8* %Ptr) {
347 entry:
348 indirectbr i8* %Ptr, [label %BrBlock, label %B2]
349
350 B2:
351 store i32 4, i32 *%P
352 br label %BrBlock
353
354 BrBlock:
355 %L = load i32* %P
356 %C = icmp eq i32 %L, 42
357 br i1 %C, label %T, label %F
358
359 T:
360 ret i32 123
361 F:
362 ret i32 1422
363 }
364