Mercurial > hg > truffle
comparison src/share/vm/opto/loopnode.cpp @ 4112:e8fdaf4a66cb
7110586: C2 generates incorrect results
Summary: Exact limit of empty loop calculated incorrectly.
Reviewed-by: iveresov, never
author | kvn |
---|---|
date | Thu, 10 Nov 2011 20:17:05 -0800 |
parents | 670a74b863fc |
children | 1bd45abaa507 |
comparison
equal
deleted
inserted
replaced
4065:78bef05801ca | 4112:e8fdaf4a66cb |
---|---|
713 int stride_con = cl->stride_con(); | 713 int stride_con = cl->stride_con(); |
714 long init_con = cl->init_trip()->get_int(); | 714 long init_con = cl->init_trip()->get_int(); |
715 long limit_con = cl->limit()->get_int(); | 715 long limit_con = cl->limit()->get_int(); |
716 julong trip_cnt = cl->trip_count(); | 716 julong trip_cnt = cl->trip_count(); |
717 long final_con = init_con + trip_cnt*stride_con; | 717 long final_con = init_con + trip_cnt*stride_con; |
718 final_con -= stride_con; | |
719 int final_int = (int)final_con; | 718 int final_int = (int)final_con; |
720 // The final value should be in integer range since the loop | 719 // The final value should be in integer range since the loop |
721 // is counted and the limit was checked for overflow. | 720 // is counted and the limit was checked for overflow. |
722 assert(final_con == (long)final_int, "final value should be integer"); | 721 assert(final_con == (long)final_int, "final value should be integer"); |
723 limit = _igvn.intcon(final_int); | 722 limit = _igvn.intcon(final_int); |