diff options
author | Wilco Dijkstra <wdijkstr@arm.com> | 2020-01-15 15:23:54 +0000 |
---|---|---|
committer | Wilco Dijkstra <wdijkstr@arm.com> | 2020-01-15 18:38:21 +0000 |
commit | bc071d3a951a98284a3f46043afd44c03c123376 (patch) | |
tree | 4fdacca959bb6ac3ad5a46af26c642f9a675a959 /gcc/tree-ssa-loop-niter.c | |
parent | 2a0f6c61b4db19535c632be68bddad74b6adb6cf (diff) | |
download | gcc-bc071d3a951a98284a3f46043afd44c03c123376.zip gcc-bc071d3a951a98284a3f46043afd44c03c123376.tar.gz gcc-bc071d3a951a98284a3f46043afd44c03c123376.tar.bz2 |
Fix ctz issues (PR93231)
Further improve the ctz recognition: Avoid ICEing on negative shift
counts or multiply constants. Check the type is a char type for the
string constant case to avoid accidentally matching a wide STRING_CST.
Add a tree_expr_nonzero_p check to allow the optimization even if
CTZ_DEFINED_VALUE_AT_ZERO returns 0 or 1. Add extra test cases.
Bootstrap OK on AArch64 and x64.
gcc/
PR tree-optimization/93231
* tree-ssa-forwprop.c (optimize_count_trailing_zeroes): Check
input_type is unsigned. Use tree_to_shwi for shift constant.
Check CST_STRING element size is CHAR_TYPE_SIZE bits.
(simplify_count_trailing_zeroes): Add test to handle known non-zero
inputs more efficiently.
testsuite/
PR tree-optimization/93231
* gcc.dg/pr90838.c: New test.
* gcc.dg/pr93231.c: New test.
* gcc.target/aarch64/pr90838.c: Use #define u 0.
Diffstat (limited to 'gcc/tree-ssa-loop-niter.c')
0 files changed, 0 insertions, 0 deletions