llvm.org GIT mirror llvm / 598ee5a
Fix the PPC subsumes-predicate check For one predicate to subsume another, they must both check the same condition register. Failure to check this prerequisite was causing miscompiles. Fixes PR18003. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197089 91177308-0d34-0410-b5e6-96231b3b80d8 Hal Finkel 6 years ago
2 changed file(s) with 69 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
987987 if (Pred2[1].getReg() == PPC::CTR8 || Pred2[1].getReg() == PPC::CTR)
988988 return false;
989989
990 // P1 can only subsume P2 if they test the same condition register.
991 if (Pred1[1].getReg() != Pred2[1].getReg())
992 return false;
993
990994 PPC::Predicate P1 = (PPC::Predicate) Pred1[0].getImm();
991995 PPC::Predicate P2 = (PPC::Predicate) Pred2[0].getImm();
992996
0 ; RUN: llc < %s -mcpu=ppc64 | FileCheck %s
1 target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v128:128:128-n32:64"
2 target triple = "powerpc64-unknown-linux-gnu"
3
4 ; Function Attrs: nounwind
5 define zeroext i1 @test1() unnamed_addr #0 align 2 {
6
7 ; CHECK-LABEL: @test1
8
9 entry:
10 br i1 undef, label %lor.end, label %lor.rhs
11
12 lor.rhs: ; preds = %entry
13 unreachable
14
15 lor.end: ; preds = %entry
16 br i1 undef, label %land.rhs, label %if.then
17
18 if.then: ; preds = %lor.end
19 br i1 undef, label %return, label %if.end.i24
20
21 if.end.i24: ; preds = %if.then
22 %0 = load i32* undef, align 4
23 %lnot.i.i16.i23 = icmp eq i32 %0, 0
24 br i1 %lnot.i.i16.i23, label %if.end7.i37, label %test.exit27.i34
25
26 test.exit27.i34: ; preds = %if.end.i24
27 br i1 undef, label %return, label %if.end7.i37
28
29 if.end7.i37: ; preds = %test.exit27.i34, %if.end.i24
30 %tobool.i.i36 = icmp eq i8 undef, 0
31 br i1 %tobool.i.i36, label %return, label %if.then9.i39
32
33 if.then9.i39: ; preds = %if.end7.i37
34 br i1 %lnot.i.i16.i23, label %return, label %lor.rhs.i.i49
35
36 ; CHECK: .LBB0_7:
37 ; CHECK: beq 1, .LBB0_10
38 ; CHECK: beq 0, .LBB0_10
39 ; CHECK: .LBB0_9:
40
41 lor.rhs.i.i49: ; preds = %if.then9.i39
42 %cmp.i.i.i.i48 = icmp ne i64 undef, 0
43 br label %return
44
45 land.rhs: ; preds = %lor.end
46 br i1 undef, label %return, label %if.end.i
47
48 if.end.i: ; preds = %land.rhs
49 br i1 undef, label %return, label %if.then9.i
50
51 if.then9.i: ; preds = %if.end.i
52 br i1 undef, label %return, label %lor.rhs.i.i
53
54 lor.rhs.i.i: ; preds = %if.then9.i
55 %cmp.i.i.i.i = icmp ne i64 undef, 0
56 br label %return
57
58 return: ; preds = %lor.rhs.i.i, %if.then9.i, %if.end.i, %land.rhs, %lor.rhs.i.i49, %if.then9.i39, %if.end7.i37, %test.exit27.i34, %if.then
59 %retval.0 = phi i1 [ false, %if.then ], [ false, %test.exit27.i34 ], [ true, %if.end7.i37 ], [ true, %if.then9.i39 ], [ %cmp.i.i.i.i48, %lor.rhs.i.i49 ], [ false, %land.rhs ], [ true, %if.end.i ], [ true, %if.then9.i ], [ %cmp.i.i.i.i, %lor.rhs.i.i ]
60 ret i1 %retval.0
61 }
62
63 attributes #0 = { nounwind }
64