This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hello world,
the attached patch extends removing trailing TRIMs in assignments for cases like a // trim(b). Regression-tested. OK for trunk?
Thomas
This time with the test case corrected (cleanup of the *.original file) and a more meaningful Subject line.
* frontend-passes.c (optimize_assignment): Follow chains of concatenation operators to the end for removing trailing TRIMS for assignments.
Index: frontend-passes.c =================================================================== --- frontend-passes.c (Revision 174391) +++ frontend-passes.c (Arbeitskopie) @@ -500,6 +500,14 @@ optimize_assignment (gfc_code * c) if (lhs->ts.type == BT_CHARACTER) { + /* Check for a // b // trim(c). Looping is probably not + necessary because the parser usually generates + (// (// a b ) trim(c) ) , but better safe than sorry. */ + + while (rhs->expr_type == EXPR_OP + && rhs->value.op.op == INTRINSIC_CONCAT) + rhs = rhs->value.op.op2; + if (rhs->expr_type == EXPR_FUNCTION && rhs->value.function.isym && rhs->value.function.isym->id == GFC_ISYM_TRIM)
Attachment:
trim_optimize_7.f90
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |