On Thu, Dec 7, 2017 at 12:26 PM, Jakub Jelinek <ja...@redhat.com> wrote: > On Thu, Dec 07, 2017 at 12:21:03PM +0100, Richard Biener wrote: >> > + if ( TREE_CODE (arg0) != INTEGER_CST) > > Also watch formatting, the space after ( doesn't belong there. > >> > + return false; >> >> Is there a reason to not do this for non-constants? (even not for >> float constants?) >> You should probably double-check there is a LHS, folding runs before DCE. >> >> > + tree splat_value = build_int_cst (TREE_TYPE (TREE_TYPE (lhs)), >> > + TREE_INT_CST_LOW (arg0)); > > tree splat_value = fold_convert (TREE_TYPE (TREE_TYPE (lhs)), arg0); > ? > TREE_INT_CST_LOW should not be used unless necessary, e.g. it can throw > the upper bits of large constants, even if the type is wide.
Indeed. For non-constants even better use gimple_convert () which will emit a separate stmt when necessary. Richard. > Jakub