public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/102872] New: If statement is always false but not figured out at gimple level
@ 2021-10-21  8:25 pinskia at gcc dot gnu.org
  2021-10-21  8:28 ` [Bug tree-optimization/102872] " pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-10-21  8:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102872

            Bug ID: 102872
           Summary: If statement is always false but not figured out at
                    gimple level
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: missed-optimization, TREE
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
void foo(void);

static int a, b;
int main() {
  for (; a; ++a) {
    unsigned short d = a;
    if (!(b | d) && d)
      foo();
  }
}
---- CUT ---
This is the reduced testcase of PR 102703 but without the store to a static
variable which then was removed.

In VRP1 we have:
  d_10 = (short unsigned int) a.3_5;
  _9 = a.3_5 & 65535;
  if (_9 == 0)
    goto <bb 4>; [50.00%]
  else
    goto <bb 6>; [50.00%]

  <bb 4> [local count: 477815112]:
  if (d_10 != 0)
    goto <bb 5>; [33.00%]
  else
    goto <bb 6>; [67.00%]

  <bb 5> [local count: 157678986]:
  foo ();

_9 and d_10 have the same value though different types.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-11-28 22:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-21  8:25 [Bug tree-optimization/102872] New: If statement is always false but not figured out at gimple level pinskia at gcc dot gnu.org
2021-10-21  8:28 ` [Bug tree-optimization/102872] " pinskia at gcc dot gnu.org
2021-10-21  8:58 ` rguenth at gcc dot gnu.org
2021-11-20  8:59 ` pinskia at gcc dot gnu.org
2021-11-22 11:17 ` rguenth at gcc dot gnu.org
2022-10-13 15:29 ` cvs-commit at gcc dot gnu.org
2022-10-13 17:02 ` amacleod at redhat dot com
2022-11-28 22:41 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).