[llvm-dev] LoopIdiomRegognize vs Preserved

Mikael Holmén via llvm-dev llvm-dev at lists.llvm.org
Mon Feb 8 01:32:53 PST 2016


Hi,

I'm having problems with the LoopIdiomRegognizer crashing on me with

An asserting value handle still pointed to this value!
UNREACHABLE executed at ../lib/IR/Value.cpp:695!

If I remove

     AU.addPreserved<LoopInfoWrapperPass>();

or

     AU.addPreserved<AAResultsWrapperPass>();

everything goes well.

The C-code triggering this is

void foo(int a[10][10])
{
     int	i, j, k;

     for (i = 0; i < 1; i++) {
         for (j = 0; j < 2; j++) {
             for (k = 0; k < 10; k++) {
                 a[j][k] = 42;
             }
         }
     }
}

First LoopIdiomRecognize replaces the store in the inner loop with a 
memset in the outer loop, and later, when examining the outer loop it 
tries to replace that memset with an even bigger memset in the outermost 
loop. But then, when removing the "old" memset, the assert blows.

I don't know LoopIdiomRecognize very well at all, is it obvious that 
AAResultsWrapperPass and/or LoopInfoWrapperPass should not be preserved 
here?

Regards,
Mikael


More information about the llvm-dev mailing list