gnu/gcc/b24418a22128668b21179dfcb73fa54ee3929ecf aarch64: Don't skip folding intrinsics even if result is unused.
Don't bail out of folding intrinsics early if the result of the function
call is unused. This assumed that function bases would always have an
implementation of `expand` to generate RTL if the call was not folded
away. This is not true of the NEON intrinsics, nearly all of which only
have an implementation of `fold`.
Instead of bailing out, compute the result and store it in a variable.
If the result is unused, it will be removed by later optimization
passes.
gcc/ChangeLog:
* config/aarch64/aarch64-acle-builtins.cc (gimple_folder::fold):
Don't bail out of folding early.
gcc/testsuite/ChangeLog:
* gcc.target/aarch64/neon/discarded_result.c: New test.
2 files changed