[LLVMdev] poison and select

John Regehr regehr at cs.utah.edu
Wed Sep 10 08:19:09 PDT 2014


> While the documentation may not match the facts on the ground, InstructionSimplify does (in my opinion) the
> right thing; an undef operand doesn't mean the entire SelectInst folds away to undef:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InstructionSimplify.cpp?revision=217342&view=m
> arkup#l2880

It seems pretty clear that this is the right semantics for select.

If we believe the documentation, then select is only useful when we can 
prove that it won't introduce a spurious poison value. This will not often 
be the case.

I'll go file a bug against the LLVM instruction reference to remind 
someone to tweak the doc. My proposed fix would be:

* Values other than phi nodes and select instructions depend on their 
operands.

* Phi nodes depend on the operand corresponding to their dynamic 
predecessor basic block.

* Select instructions depend on their selected operand.

John


More information about the llvm-dev mailing list