[llvm-commits] [llvm] r133022 - in /llvm/trunk: lib/CodeGen/SelectionDAG/DAGCombiner.cpp test/CodeGen/X86/shl_undef.ll
Duncan Sands
baldrick at free.fr
Wed Jun 15 09:13:00 PDT 2011
Hi Evan,
> I'm not sure I understand this. It seems like the test cases are dependent on undefined behavior? I don't think anything can assume shl undef, 1 lsb is zero. Anything arithmetics involving undef should be safely folded into undef.
I think this is the difference between "undef" and the newly introduced "trap
value": the result of any operation on a trap value is a trap value. But undef
represents a real, but unknown value: the result of an operation on an undef
must be a value that can be obtained by substituting some normal value for the
undef. This is why the IR carefully folds "and undef, 3" to zero for example;
it would be wrong to fold this to, say, 4, because there is no value of X for
which "and X, 3" is equal to 4.
Ciao, Duncan.
More information about the llvm-commits
mailing list