mirror of
https://github.com/postgres/postgres.git
synced 2025-06-26 12:21:12 +03:00
Remove unnecessary local variables to work around an icc optimization bug.
Buildfarm member dunlin has been crashing since commit 8b49a60
, but other
machines seem fine with that code. It turns out that removing the local
variables in ordered_set_startup() that are copies of fields in "qstate"
dodges the problem. This might cost a few cycles on register-rich
machines, but it's probably a wash on others, and in any case this code
isn't performance-critical. Thanks to Jeremy Drake for off-list
investigation.
This commit is contained in:
@ -159,27 +159,17 @@ ordered_set_startup(FunctionCallInfo fcinfo, bool use_tuples)
|
|||||||
if (use_tuples)
|
if (use_tuples)
|
||||||
{
|
{
|
||||||
bool ishypothetical = (aggref->aggkind == AGGKIND_HYPOTHETICAL);
|
bool ishypothetical = (aggref->aggkind == AGGKIND_HYPOTHETICAL);
|
||||||
AttrNumber *sortColIdx;
|
|
||||||
Oid *sortOperators;
|
|
||||||
Oid *eqOperators;
|
|
||||||
Oid *sortCollations;
|
|
||||||
bool *sortNullsFirsts;
|
|
||||||
ListCell *lc;
|
ListCell *lc;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (ishypothetical)
|
if (ishypothetical)
|
||||||
numSortCols++; /* make space for flag column */
|
numSortCols++; /* make space for flag column */
|
||||||
qstate->numSortCols = numSortCols;
|
qstate->numSortCols = numSortCols;
|
||||||
qstate->sortColIdx = sortColIdx =
|
qstate->sortColIdx = (AttrNumber *) palloc(numSortCols * sizeof(AttrNumber));
|
||||||
(AttrNumber *) palloc(numSortCols * sizeof(AttrNumber));
|
qstate->sortOperators = (Oid *) palloc(numSortCols * sizeof(Oid));
|
||||||
qstate->sortOperators = sortOperators =
|
qstate->eqOperators = (Oid *) palloc(numSortCols * sizeof(Oid));
|
||||||
(Oid *) palloc(numSortCols * sizeof(Oid));
|
qstate->sortCollations = (Oid *) palloc(numSortCols * sizeof(Oid));
|
||||||
qstate->eqOperators = eqOperators =
|
qstate->sortNullsFirsts = (bool *) palloc(numSortCols * sizeof(bool));
|
||||||
(Oid *) palloc(numSortCols * sizeof(Oid));
|
|
||||||
qstate->sortCollations = sortCollations =
|
|
||||||
(Oid *) palloc(numSortCols * sizeof(Oid));
|
|
||||||
qstate->sortNullsFirsts = sortNullsFirsts =
|
|
||||||
(bool *) palloc(numSortCols * sizeof(bool));
|
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
foreach(lc, sortlist)
|
foreach(lc, sortlist)
|
||||||
@ -191,22 +181,22 @@ ordered_set_startup(FunctionCallInfo fcinfo, bool use_tuples)
|
|||||||
/* the parser should have made sure of this */
|
/* the parser should have made sure of this */
|
||||||
Assert(OidIsValid(sortcl->sortop));
|
Assert(OidIsValid(sortcl->sortop));
|
||||||
|
|
||||||
sortColIdx[i] = tle->resno;
|
qstate->sortColIdx[i] = tle->resno;
|
||||||
sortOperators[i] = sortcl->sortop;
|
qstate->sortOperators[i] = sortcl->sortop;
|
||||||
eqOperators[i] = sortcl->eqop;
|
qstate->eqOperators[i] = sortcl->eqop;
|
||||||
sortCollations[i] = exprCollation((Node *) tle->expr);
|
qstate->sortCollations[i] = exprCollation((Node *) tle->expr);
|
||||||
sortNullsFirsts[i] = sortcl->nulls_first;
|
qstate->sortNullsFirsts[i] = sortcl->nulls_first;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ishypothetical)
|
if (ishypothetical)
|
||||||
{
|
{
|
||||||
/* Add an integer flag column as the last sort column */
|
/* Add an integer flag column as the last sort column */
|
||||||
sortColIdx[i] = list_length(aggref->args) + 1;
|
qstate->sortColIdx[i] = list_length(aggref->args) + 1;
|
||||||
sortOperators[i] = Int4LessOperator;
|
qstate->sortOperators[i] = Int4LessOperator;
|
||||||
eqOperators[i] = Int4EqualOperator;
|
qstate->eqOperators[i] = Int4EqualOperator;
|
||||||
sortCollations[i] = InvalidOid;
|
qstate->sortCollations[i] = InvalidOid;
|
||||||
sortNullsFirsts[i] = false;
|
qstate->sortNullsFirsts[i] = false;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user