summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2010-01-18 12:59:50 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2010-01-18 12:59:50 +0000
commitfacbb5c498648ae0cfbf389474cee2864e655853 (patch)
treef9a52fa606fef941b98d37c4035a5e8ec43edfcc /gcc
parent61061ad69ff5886ac5b804a1af09fe1d781ff4c3 (diff)
downloadgcc-facbb5c498648ae0cfbf389474cee2864e655853.tar.gz
2010-01-18 Richard Guenther <rguenther@suse.de>
PR middle-end/39954 * cfgexpand.c (expand_call_stmt): TER pointer arguments in builtin calls. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@156008 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/cfgexpand.c18
2 files changed, 23 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2ad9c06d356..795b89c29f1 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2010-01-18 Richard Guenther <rguenther@suse.de>
+ PR middle-end/39954
+ * cfgexpand.c (expand_call_stmt): TER pointer arguments in
+ builtin calls.
+
+2010-01-18 Richard Guenther <rguenther@suse.de>
+
PR tree-optimization/42781
* tree-ssa-structalias.c (find_what_var_points_to): Skip
restrict processing only if the original variable was
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 70d2b355aa1..788242c3d82 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -1746,15 +1746,31 @@ expand_call_stmt (gimple stmt)
tree exp;
tree lhs = gimple_call_lhs (stmt);
size_t i;
+ bool builtin_p;
+ tree decl;
exp = build_vl_exp (CALL_EXPR, gimple_call_num_args (stmt) + 3);
CALL_EXPR_FN (exp) = gimple_call_fn (stmt);
+ decl = gimple_call_fndecl (stmt);
+ builtin_p = decl && DECL_BUILT_IN (decl);
+
TREE_TYPE (exp) = gimple_call_return_type (stmt);
CALL_EXPR_STATIC_CHAIN (exp) = gimple_call_chain (stmt);
for (i = 0; i < gimple_call_num_args (stmt); i++)
- CALL_EXPR_ARG (exp, i) = gimple_call_arg (stmt, i);
+ {
+ tree arg = gimple_call_arg (stmt, i);
+ gimple def;
+ /* TER addresses into arguments of builtin functions so we have a
+ chance to infer more correct alignment information. See PR39954. */
+ if (builtin_p
+ && TREE_CODE (arg) == SSA_NAME
+ && (def = get_gimple_for_ssa_name (arg))
+ && gimple_assign_rhs_code (def) == ADDR_EXPR)
+ arg = gimple_assign_rhs1 (def);
+ CALL_EXPR_ARG (exp, i) = arg;
+ }
if (gimple_has_side_effects (stmt))
TREE_SIDE_EFFECTS (exp) = 1;