diff mbox

[IPCP] Remove unreachable code

Message ID 9a16aa02-ca87-48a9-562d-aa9042356260@linaro.org
State New
Headers show

Commit Message

Kugan Vivekanandarajah Oct. 24, 2016, 10:46 p.m. UTC
Hi,

I noticed that in ipcp_bits_lattice::meet_with we have:

   else if (TREE_CODE_CLASS (code) == tcc_unary)
   ....
   else if (code == NOP_EXPR)
   ....

Since TREE_CODE_CLASS for NOP_EXPR is tcc_unary, if (code == NOP_EXPR) 
is unreachable and therefore removing it. I also don't think that we 
need any special casing for NOP_EXPR here. bit_value_unop handles 
already handles CASE_CONVERT.

Is this OK if no regressions in bootstrap and regression testing.

Thanks,
Kugan




gcc/ChangeLog:

2016-10-25  Kugan Vivekanandarajah  <kuganv@linaro.org>

	* ipa-cp.c (ipcp_bits_lattice::meet_with): Remove unreachable code.

Comments

Prathamesh Kulkarni Oct. 25, 2016, 3:39 a.m. UTC | #1
On 25 October 2016 at 04:16, kugan <kugan.vivekanandarajah@linaro.org> wrote:
> Hi,

>

> I noticed that in ipcp_bits_lattice::meet_with we have:

>

>   else if (TREE_CODE_CLASS (code) == tcc_unary)

>   ....

>   else if (code == NOP_EXPR)

>   ....

>

> Since TREE_CODE_CLASS for NOP_EXPR is tcc_unary, if (code == NOP_EXPR) is

> unreachable and therefore removing it. I also don't think that we need any

> special casing for NOP_EXPR here. bit_value_unop handles already handles

> CASE_CONVERT.

Oops, sorry about that :/
IICU NOP_EXPR is present when the pass-thru operation is "simple"
involving only the argument.
bit_value_unop() already handles the case for NOP_EXPR in
CASE_CONVERT, so I suppose
NOP_EXPR won't need any special casing.
Thanks for catching this!

Regards,
Prathamesh
>

> Is this OK if no regressions in bootstrap and regression testing.

>

> Thanks,

> Kugan

>

>

>

>

> gcc/ChangeLog:

>

> 2016-10-25  Kugan Vivekanandarajah  <kuganv@linaro.org>

>

>         * ipa-cp.c (ipcp_bits_lattice::meet_with): Remove unreachable code.
Jeff Law Nov. 5, 2016, 2:44 a.m. UTC | #2
On 10/24/2016 04:46 PM, kugan wrote:
> Hi,

>

> I noticed that in ipcp_bits_lattice::meet_with we have:

>

>   else if (TREE_CODE_CLASS (code) == tcc_unary)

>   ....

>   else if (code == NOP_EXPR)

>   ....

>

> Since TREE_CODE_CLASS for NOP_EXPR is tcc_unary, if (code == NOP_EXPR)

> is unreachable and therefore removing it. I also don't think that we

> need any special casing for NOP_EXPR here. bit_value_unop handles

> already handles CASE_CONVERT.

>

> Is this OK if no regressions in bootstrap and regression testing.

>

> Thanks,

> Kugan

>

>

>

>

> gcc/ChangeLog:

>

> 2016-10-25  Kugan Vivekanandarajah  <kuganv@linaro.org>

>

>     * ipa-cp.c (ipcp_bits_lattice::meet_with): Remove unreachable code.

OK.
jeff
diff mbox

Patch

diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index 1dc5cb6..527ff27 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -1070,12 +1070,6 @@  ipcp_bits_lattice::meet_with (ipcp_bits_lattice& other, unsigned precision,
 	return set_to_bottom ();
     }
 
-  else if (code == NOP_EXPR)
-    {
-      adjusted_value = other.m_value;
-      adjusted_mask = other.m_mask;
-    }
-
   else
     return set_to_bottom ();