At 2013-09-03 00:16:19,"Tobias Grosser" <tobias@grosser.es> wrote:>On 09/02/2013 08:30 AM, Star Tan wrote:<br>>> At 2013-09-02 16:34:24,"Tobias Grosser" <tobias@grosser.es> wrote:<br>>><br>>>> On 09/01/2013 08:01 PM, Star Tan wrote:<br>>>>> At 2013-08-25 02:10:02,"Tobias Grosser" <tobias@grosser.es> wrote:<br>>>>>> On 08/23/2013 08:25 AM, Star Tan wrote:<br>>>>>>>    Hi all,<br>>>>>>><br>>>>>>><br>>>>>>>    I have attached a patch file to fix up the CodeGen assert fail, which is also reported in a recent bug  http://llvm.org/bugs/show_bug.cgi?id=16944<br>>>>>><br>>>>>> Hi Star Tan,<br>>>>>><br>>>>>> thanks for looking into this bug. The patch itself looks good and the<br>>>>>> testcase is nicely small.<br>>>>>><br>>>>>> However, when running the test with 'opt' I get:<br>>>>>><br>>>>>> PHINode should have one entry for each predecessor of its parent basic<br>>>>>> block!<br>>>>>>      %indvar = phi i64 [ 0, %entry ], [ %0, %for.inc ]<br>>>>>><br>>>>>> So the IR in the test case itself is already incorrect.<br>>>>><br>>>>> Sorry for the stupid mistake. I have attached a new patch file!<br>>>><br>>>> Great. This one looks correct.<br>>>><br>>>>> Also, I am a little unhappy with the fact that we need to run<br>>>>><br>>>>>> -polly-opt-isl to reproduce this bug. I would very much prefer to find a<br>>>>>> test case that only runs 'opt %loadPolly -polly-codegen  < %s'. This ensures<br>>>>>> that changes in -polly-opt-isl can not accidentally stop this test case<br>>>>>> from testing the code path you fixed in this patch.<br>>>>><br>>>>> Yes, you are right. But it seems difficult to construct a testcase that will show this bug using only "opt %loadPolly -polly-codegen".<br>>>>> Our testcase fails with the following command:<br>>>>> $ opt %loadPolly -basicaa -polly-opt-isl -polly-codegen test.ll<br>>>>><br>>>>> but it works well with the following commands:<br>>>>> $ opt %loadPolly -basicaa -polly-opt-isl -S -o test_1.ll test.ll<br>>>>> $ opt %loadPolly -basicaa -polly-codegen test_1.ll<br>>>>><br>>>>> The key of producing the bug is to construct a stmt_guard statment, so it will call codegen((clast_guard *)). Preliminary investigation shows that the  'stmt_guard' occurs only if we run opt-isl before codegen.  Sorry I have not found such a testcase by now.<br>>>><br>>>> I just looked into this and I could also not find a trivial test case<br>>>> that yields a guard statement. However, you can use<br>>>><br>>>> opt -polly-opt-isl -polly-export-jscop<br>>>><br>>>> to get a jscop file and the use opt -polly-import-jscop to read in this<br>>>> jscop file instead of running polly-opt-isl. This at least removes the<br>>>> dependency on the isl scheduler.<br>>>><br>>>> test/Cloog/CodeGen/simple_vec_stride_one.ll<br>>>><br>>>> The above test case should give an example how to use the import/export<br>>>> of jscops.<br>>><br>>> Thank you so much for your very helpful suggestion.  Yes, Jscop is a very help tool~<br>>> I have attached a new patch file that reads Jscop file to avoid dependence to polly-opt-isl.<br>><br>>Great. This one looks perfect. I committed it in r189764.<br>><br>>Please feel free to close the related bug reports.<br>><br>>Cheers,<br>>Tobias<br><br>Thank you. I have closed the bug 16944.<br><br>Star