[llvm-dev] A bug related with undef value when bootstrap MemorySSA.cpp

Nuno Lopes via llvm-dev llvm-dev at lists.llvm.org
Mon Jul 17 01:24:19 PDT 2017

Cool, thanks for debugging this issue and letting us know.

We have a few patches to fix this issue:
 - Introduce freeze in IR: https://reviews.llvm.org/D29011
 - Lowering freeze: https://reviews.llvm.org/D29014
 - Fix loop unswitch: https://reviews.llvm.org/D29015

Bonus patches to recover perf:
 - Be less conservative in loop unswitching: https://reviews.llvm.org/D29016
 - Instcombine support for freeze: https://reviews.llvm.org/D29013

It would be great if you could try out these patches to see if the bug goes away.


-----Original Message-----
From: Sanjoy Das
Sent: 16 de julho de 2017 02:47
To: Wei Mi 
Cc: llvm-dev; Xinliang David Li; Sanjoy Das; Nuno Lopes; John Regehr; Juneyoung Lee 
Subject: Re: [llvm-dev] A bug related with undef value when bootstrap MemorySSA.cpp

Hi Wei,

[+CC the other undef folks]

This is the same bug as https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugs.llvm.org%2Fshow_bug.cgi%3Fid%3D31652&data=02%7C01%7Cnlopes%40microsoft.com%7C971ae2063c8b420d2f1008d4cbec8f22%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636357664258073352&sdata=iCy8kUlWwJzQpXbXvOuhHpKyXBnntZPGvn%2FtxWsqun8%3D&reserved=0.
The short answer here is that the loop unswitch transform and the GVN transform are justified via conflicting specifications of undef (that is, LoopUnswitch and GVN don't agree on the definition of undef).  The
long(er) answer is in the bug.

Unfortunately, there is no real way to fix this in the IR today (beyond hacking GVN / LoopUnswitch to back off on these transforms enough to not trigger this case).  We will need to specify and implement a consistent definition of undef / poison to truly fix this, one of which we've already proposed.

-- Sanjoy

More information about the llvm-dev mailing list