Mercurial > hg > graal-jvmci-8
comparison src/share/vm/opto/parse2.cpp @ 37:73970d8c0b27
6671250: In Parse::do_if() old Cmp node 'c' should be replaced with new one after BoolNode transformation
Summary: In Parse::do_if() 'c' (CmpNode) node may be changed during BoolNode transformation so 'c' may became dead but the node is referenced later in the code.
Reviewed-by: never
author | kvn |
---|---|
date | Wed, 05 Mar 2008 11:33:31 -0800 |
parents | ff5961f4c095 |
children | ba764ed4b6f2 |
comparison
equal
deleted
inserted
replaced
36:f34d9da7acb2 | 37:73970d8c0b27 |
---|---|
1020 | 1020 |
1021 Node* tst0 = new (C, 2) BoolNode(c, btest); | 1021 Node* tst0 = new (C, 2) BoolNode(c, btest); |
1022 Node* tst = _gvn.transform(tst0); | 1022 Node* tst = _gvn.transform(tst0); |
1023 BoolTest::mask taken_btest = BoolTest::illegal; | 1023 BoolTest::mask taken_btest = BoolTest::illegal; |
1024 BoolTest::mask untaken_btest = BoolTest::illegal; | 1024 BoolTest::mask untaken_btest = BoolTest::illegal; |
1025 if (btest == BoolTest::ne) { | 1025 |
1026 // For now, these are the only cases of btest that matter. (More later.) | 1026 if (tst->is_Bool()) { |
1027 taken_btest = taken_if_true ? btest : BoolTest::eq; | 1027 // Refresh c from the transformed bool node, since it may be |
1028 untaken_btest = taken_if_true ? BoolTest::eq : btest; | 1028 // simpler than the original c. Also re-canonicalize btest. |
1029 // This wins when (Bool ne (Conv2B p) 0) => (Bool ne (CmpP p NULL)). | |
1030 // That can arise from statements like: if (x instanceof C) ... | |
1031 if (tst != tst0) { | |
1032 // Canonicalize one more time since transform can change it. | |
1033 btest = tst->as_Bool()->_test._test; | |
1034 if (!BoolTest(btest).is_canonical()) { | |
1035 // Reverse edges one more time... | |
1036 tst = _gvn.transform( tst->as_Bool()->negate(&_gvn) ); | |
1037 btest = tst->as_Bool()->_test._test; | |
1038 assert(BoolTest(btest).is_canonical(), "sanity"); | |
1039 taken_if_true = !taken_if_true; | |
1040 } | |
1041 c = tst->in(1); | |
1042 } | |
1043 BoolTest::mask neg_btest = BoolTest(btest).negate(); | |
1044 taken_btest = taken_if_true ? btest : neg_btest; | |
1045 untaken_btest = taken_if_true ? neg_btest : btest; | |
1029 } | 1046 } |
1030 | 1047 |
1031 // Generate real control flow | 1048 // Generate real control flow |
1032 float true_prob = (taken_if_true ? prob : untaken_prob); | 1049 float true_prob = (taken_if_true ? prob : untaken_prob); |
1033 IfNode* iff = create_and_map_if(control(), tst, true_prob, cnt); | 1050 IfNode* iff = create_and_map_if(control(), tst, true_prob, cnt); |