|
From: <sv...@va...> - 2006-05-14 18:47:03
|
Author: sewardj
Date: 2006-05-14 19:46:55 +0100 (Sun, 14 May 2006)
New Revision: 1617
Log:
Add an IR folding rule to convert Add32(x,x) into Shl32(x,1). This
fixes #118466 and it also gets rid of a bunch of false positives for
KDE 3.5.2 built by gcc-4.0.2 on x86, of the form shown below.
Use of uninitialised value of size 4
at 0x4BFC342: QIconSet::pixmap(QIconSet::Size, QIconSet::Mode,=20
QIconSet::State) const (qiconset.cpp:5=
30)
by 0x4555BE7: KToolBarButton::drawButton(QPainter*)=20
(ktoolbarbutton.cpp:536)
by 0x4CB8A0A: QButton::paintEvent(QPaintEvent*) (qbutton.cpp:887)
Modified:
trunk/priv/ir/iropt.c
Modified: trunk/priv/ir/iropt.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/priv/ir/iropt.c 2006-05-13 23:08:06 UTC (rev 1616)
+++ trunk/priv/ir/iropt.c 2006-05-14 18:46:55 UTC (rev 1617)
@@ -1405,6 +1405,20 @@
e2 =3D e->Iex.Binop.arg1;
} else
=20
+ /* Add32(t,t) =3D=3D> t << 1. Memcheck doesn't understand that
+ x+x produces a defined least significant bit, and it seems
+ simplest just to get rid of the problem by rewriting it
+ out, since the opportunity to do so exists. */
+ if (e->Iex.Binop.op =3D=3D Iop_Add32
+ && e->Iex.Binop.arg1->tag =3D=3D Iex_Tmp
+ && e->Iex.Binop.arg2->tag =3D=3D Iex_Tmp
+ && e->Iex.Binop.arg1->Iex.Tmp.tmp=20
+ =3D=3D e->Iex.Binop.arg2->Iex.Tmp.tmp) {
+ e2 =3D IRExpr_Binop(Iop_Shl32,
+ e->Iex.Binop.arg1,
+ IRExpr_Const(IRConst_U8(1)));
+ } else
+
/* Or64/Add64(x,0) =3D=3D> x */
if ((e->Iex.Binop.op =3D=3D Iop_Add64 || e->Iex.Binop.op =3D=3D=
Iop_Or64)
&& e->Iex.Binop.arg2->tag =3D=3D Iex_Const
|