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#l2880It 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.
Doesn't a select instruction also depend on the predicate (boolean) value?
John
--Vikram Adve
Professor, Department of Computer Science
University of Illinois at Urbana-Champaign
vadve@illinois.edu
http://llvm.org