This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug rtl-optimization/77499] [7 Regression] Regression after code-hoisting, due to combine pass failing to evaluate known value range


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

Jeffrey A. Law <law at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-02-15
     Ever confirmed|0                           |1

--- Comment #14 from Jeffrey A. Law <law at redhat dot com> ---
So the extensions seem to be directly related to the ARM's definition of
PROMOTE_FUNCTION_MODE.  Obviously we can't change that, but it's something to
keep in mind.

REE (if enabled) won't catch this case for multiple reasons.

So one odd way to perhaps make this work better would be to start with the code
prior to hoisting which looks something like this:

;;   basic block 3, loop depth 1
;;    pred:       6
;;                2
  # x_16 = PHI <x_3(6), x_6(D)(2)>
  # c_18 = PHI <c_14(6), c_7(D)(2)>
  _1 = c_18 % 3;
  if (_1 != 0)
    goto <bb 4>; [50.00%]
  else
    goto <bb 5>; [50.00%]
;;    succ:       4
;;                5

;;   basic block 4, loop depth 1
;;    pred:       3
  _2 = x_16 >> 1;
  x_12 = _2 ^ 45345;
  goto <bb 6>; [100.00%]
;;    succ:       6

;;   basic block 5, loop depth 1
;;    pred:       3
  x_11 = x_16 >> 1;
;;    succ:       6

;;   basic block 6, loop depth 1
;;    pred:       4
;;                5
  # x_3 = PHI <x_12(4), x_11(5)>
  c_14 = c_18 - e_13(D);
  if (d_8(D) < c_14)
    goto <bb 3>; [85.00%]
  else
    goto <bb 7>; [15.00%]
;;    succ:       3
;;                7


Then realize that block #5 can be rewritten as:
;;   basic block 5, loop depth 1
;;    pred:       3
  T = x_16 >> 1;
  x_11 = T ^ 0  (we happen to know that _1 has the value zero here)

Then we sink the common statements out of BBs 4 & 5 into bb6 which would looke
like

T = PHI (45345 (4), 0 (5))
T2 = x_16 >> 1;
x_3 = T2 ^ T;
c_14 = ...

That may bring the key statements into the same block and give the combiner a
chance.  But it's a fairly convoluted approach to this problem.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]