From c95d8d9f9ba1966cb036edf48a419e6cace8170b Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Wed, 10 Mar 2021 18:48:58 -0600 Subject: [PATCH] Optimize away unneeded floating-point conversions after loads. --- DAG.pas | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/DAG.pas b/DAG.pas index 913d376..72ef77b 100644 --- a/DAG.pas +++ b/DAG.pas @@ -1430,6 +1430,11 @@ case op^.opcode of {check for optimizations of this node} op^.left^.optype := totype.optype; opv := op^.left; end; {if} + if totype.optype in [cgReal,cgDouble,cgExtended,cgComp] then + if (totype.optype = op^.left^.optype) or + (totype.optype = cgExtended) or + ((totype.optype = cgDouble) and (op^.left^.optype = cgReal)) then + opv := op^.left; end {else if} else if op^.q in [$40,$41,$50,$51] then begin {any long type to byte type}