[LLVMdev] poison and select

John Regehr regehr at cs.utah.edu
Thu Sep 18 19:45:49 PDT 2014


Today I ran into another aspect of the poison problem...

Basically, SimplifyCFG wants to take

   expr1 && expr2

and flatten it into

   x = expr1
   y = expr2
   x&y

This isn't safe when expr2 might execute UB.  The consequence is that no 
LLVM shift instruction is safe to speculatively execute, nor is any 
nsw/nuw/exact variant, unless the operands can be proven to be in bounds.

Real example here:

   http://llvm.org/bugs/show_bug.cgi?id=20997

John



More information about the llvm-dev mailing list