aboutsummaryrefslogtreecommitdiff
path: root/gcc/print-rtl-function.c
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2021-03-10 19:38:21 -0800
committerIan Lance Taylor <iant@golang.org>2021-03-11 15:48:10 -0800
commit7ad5a72c8bc6aa71a0d195ddfa207db01265fe0b (patch)
tree764937d8460563db6132d7c75e19b95ef3ea6ea8 /gcc/print-rtl-function.c
parent3857edb5d32dcdc11d9a2fe3ad7c156c52a1ec7f (diff)
downloadgcc-7ad5a72c8bc6aa71a0d195ddfa207db01265fe0b.zip
gcc-7ad5a72c8bc6aa71a0d195ddfa207db01265fe0b.tar.gz
gcc-7ad5a72c8bc6aa71a0d195ddfa207db01265fe0b.tar.bz2
compiler: create temporaries for heap variables
The compiler generally doesn't create a temporary for an expression that is a variable, because it's normally valid to simply reload the value from the variable. However, if the variable is in the heap, then loading the value is a pointer indirection. The process of creating GCC IR can cause the variable load and the pointer indirection to be split, such that the second evaluation only does the pointer indirection. If there are conditionals in between the two uses, this can cause the second use to load the pointer from an uninitialized register. Avoid this by introducing a new Expression method that returns whether it is safe to evaluate an expression multiple times, and use it everywhere. The test case is https://golang.org/cl/300789. Fixes golang/go#44383 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/300809
Diffstat (limited to 'gcc/print-rtl-function.c')
0 files changed, 0 insertions, 0 deletions