Req #71102 [NEW]: Dead code elimination

From: Date: Sat, 12 Dec 2015 14:05:38 +0000
Subject: Req #71102 [NEW]: Dead code elimination
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-197829@lists.php.net to get a copy of this message
From:             flip101 at gmail dot com
Operating system: 
PHP version:      Irrelevant
Package:          Performance problem
Bug Type:         Feature/Change Request
Bug description:Dead code elimination

Description:
------------
When php parses the source files and converts it to bytecode, does it do
dead code elimination? For things like

if (false) {}
or when using constants (self defined or predefined)
or when checking certain expressions such as   if (4 > 10-15) {}

I couldn't find anything about this after searching. It would certainly
benefit libraries which have a lot of version checks and checks on which
operating system it's using. To me (unknowingly of anything happening in
the compiler) it seems a bit low hanging fruit optimization, but perhaps
to cover all the edge cases is not so trivial. However a partial
implementation would already help a lot. In case it does exist please
link to relevant documentation or source files.


-- 
Edit bug report at https://bugs.php.net/bug.php?id=71102&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=71102&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=71102&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=71102&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=71102&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=71102&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=71102&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=71102&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=71102&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=71102&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=71102&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=71102&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=71102&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=71102&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71102&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=71102&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=71102&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=71102&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71102&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=71102&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=71102&r=mysqlcfg



Thread (4 messages)

« previous php.bugs (#197829) next »