mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 12:43:36 +01:00
74624d8649
Reapply with DTU update moved after CFG update, which is a requirement of the API. ----- Non-feasible control-flow edges are currently removed by replacing the branch condition with a constant and then calling ConstantFoldTerminator. This happens in a rather roundabout manner, by inspecting the users (effectively: predecessors) of unreachable blocks, and further complicated by the need to explicitly materialize the condition for "forced" edges. I would like to extend SCCP to discard switch conditions that are non-feasible based on range information, but this is incompatible with the current approach (as there is no single constant we could use.) Instead, this patch explicitly removes non-feasible edges. It currently only needs to handle the case where there is a single feasible edge. The llvm_unreachable() branch will need to be implemented for the aforementioned switch improvement. Differential Revision: https://reviews.llvm.org/D84264
42 lines
1.3 KiB
LLVM
42 lines
1.3 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
|
; RUN: opt -S -ipsccp < %s | FileCheck %s
|
|
; RUN: opt -S -passes='ipsccp,function(verify<domtree>)' < %s | FileCheck %s
|
|
|
|
; DTU should not crash.
|
|
|
|
define i32 @test() {
|
|
; CHECK-LABEL: @test(
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: br label [[FOR_BODY:%.*]]
|
|
; CHECK: for.body:
|
|
; CHECK-NEXT: br label [[IF_THEN2:%.*]]
|
|
; CHECK: if.then2:
|
|
; CHECK-NEXT: br label [[FOR_INC:%.*]]
|
|
; CHECK: for.inc:
|
|
; CHECK-NEXT: unreachable
|
|
;
|
|
entry:
|
|
br label %for.body
|
|
|
|
for.body: ; preds = %entry
|
|
br i1 true, label %if.then2, label %if.else
|
|
|
|
if.then2: ; preds = %for.body
|
|
br label %for.inc
|
|
|
|
if.else: ; preds = %for.body
|
|
br i1 undef, label %lor.rhs, label %if.then19.critedge
|
|
|
|
lor.rhs: ; preds = %if.else
|
|
br i1 undef, label %if.then19, label %for.inc
|
|
|
|
if.then19.critedge: ; preds = %if.else
|
|
br label %if.then19
|
|
|
|
if.then19: ; preds = %if.then19.critedge, %lor.rhs
|
|
unreachable
|
|
|
|
for.inc: ; preds = %lor.rhs, %if.then2
|
|
unreachable
|
|
}
|