On 07/13/2016 04:15 PM, Richard Biener wrote: > so not exactly a 50/50 prediction. It is predicted by early return > predictor it seems. If I make the predictor not apply we predict > it as 50/50 chance. Hmm. Honza?
Yes, following test-case eliminates the early return predictor: int foo(int x, int *v) { if (x != 0) x = x / 10; if (v) *v += 123; return x; } ;; basic block 2, loop depth 0, count 0, freq 10000, maybe hot ;; prev block 0, next block 3, flags: (NEW, REACHABLE) ;; pred: ENTRY [100.0%] (FALLTHRU,EXECUTABLE) if (x_5(D) != 0) goto <bb 3>; else goto <bb 4>; ;; succ: 3 [50.0%] (TRUE_VALUE,EXECUTABLE) ;; 4 [50.0%] (FALSE_VALUE,EXECUTABLE) ;; basic block 3, loop depth 0, count 0, freq 5000, maybe hot ;; prev block 2, next block 4, flags: (NEW, REACHABLE) ;; pred: 2 [50.0%] (TRUE_VALUE,EXECUTABLE) x_6 = x_5(D) / 10; and there's not predictor: Predictions for bb 2 no prediction heuristics: 50.0% combined heuristics: 50.0% Martin