File tree Expand file tree Collapse file tree 2 files changed +36
-1
lines changed
test/Transforms/SimplifyCFG Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -3732,7 +3732,9 @@ static bool mergeConditionalStoreToAddress(
3732
3732
return false ;
3733
3733
3734
3734
// Now check the stores are compatible.
3735
- if (!QStore->isUnordered () || !PStore->isUnordered ())
3735
+ if (!QStore->isUnordered () || !PStore->isUnordered () ||
3736
+ PStore->getValueOperand ()->getType () !=
3737
+ QStore->getValueOperand ()->getType ())
3736
3738
return false ;
3737
3739
3738
3740
// Check that sinking the store won't cause program behavior changes. Sinking
Original file line number Diff line number Diff line change 44
44
%phi = phi ptr [ %gep1 , %if ], [ %gep2 , %else ]
45
45
ret ptr %phi
46
46
}
47
+
48
+ define void @test_cond_store_merge (i1 %arg , i1 %arg2 , ptr %p ) {
49
+ ; CHECK-LABEL: @test_cond_store_merge(
50
+ ; CHECK-NEXT: bb:
51
+ ; CHECK-NEXT: br i1 [[ARG:%.*]], label [[BB2:%.*]], label [[BB3:%.*]]
52
+ ; CHECK: bb2:
53
+ ; CHECK-NEXT: store i64 0, ptr [[P:%.*]], align 32
54
+ ; CHECK-NEXT: br label [[BB3]]
55
+ ; CHECK: bb3:
56
+ ; CHECK-NEXT: br i1 [[ARG2:%.*]], label [[BB4:%.*]], label [[BB5:%.*]]
57
+ ; CHECK: bb4:
58
+ ; CHECK-NEXT: store double 0.000000e+00, ptr [[P]], align 32
59
+ ; CHECK-NEXT: br label [[BB5]]
60
+ ; CHECK: bb5:
61
+ ; CHECK-NEXT: ret void
62
+ ;
63
+ bb:
64
+ br i1 %arg , label %bb2 , label %bb3
65
+
66
+ bb2: ; preds = %bb
67
+ store i64 0 , ptr %p , align 32
68
+ br label %bb3
69
+
70
+ bb3: ; preds = %bb2, %bb
71
+ br i1 %arg2 , label %bb4 , label %bb5
72
+
73
+ bb4: ; preds = %bb3
74
+ store double 0 .000000e+00 , ptr %p , align 32
75
+ br label %bb5
76
+
77
+ bb5: ; preds = %bb4, %bb3
78
+ ret void
79
+ }
You can’t perform that action at this time.
0 commit comments