[LLVMdev] "equivalent" .ll files diverge after optimizations are applied

Chris Lattner
2010-09-01T05:19:17Z

On Aug 31, 2010, at 11:18 AM, Argyrios Kyrtzidis wrote:

> Hi,
>
> I've attached 2 .ll files which are supposed to be equivalent but
'unopt-fail.ll' causes a crash in webkit's test suite while
'unopt-pass.ll' does not. I can't give more details about the crash,
when I run the crashing test it in isolation it passes, when I run the full
suite it crashes; it boggles the mind.
>
> Below I provide the optimized asm that is produced from each file. Could
you give a hint on what is the problem ?
> I also attached 't.cpp' which approximates the source that the .ll
files came from.

Hi Argiris,

The real problem here is that the X86 backend is turning datatypes like <1 x
i64> into MMX operations, but doesn't do so in a safe way (it's not
inserting the requisite EMMS instructions).  After discussing this with Dale and
Bill, the right fix is to stop mapping generic vectors onto MMX operations.
This will define away the existing -disable-mmx flag and make stuff like this
impossible.

However, this isn't going to happen in the next couple days, certainly not
in time for the 2.8 release branch on friday.  As such, I checked in a horrible
hack in r112696 that prevents SRoA from introducing mmx specific vector types.
I'm not aware of a target where those datatypes are actually useful, so this
shouldn't be bad.  On your testcase, no mmx operations are produced.

Please let me know if you see any other MMX stuff being generated.

-Chris