In function foldSelectToCopysign, we can allow undefs when
matching vectors.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
This does not look correct.
In the example test, if both elements of X are negative, we should return <-42.0, -42.0>. But after this transform, we will return <-42.0, undef>?
Sorry - I missed the invert / fneg. That should be:
In the example test, if both elements of X are positive, we should return <-42.0, -42.0>. But after this transform, we will return <-42.0, undef>?
llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp | ||
---|---|---|
2307–2308 | This might be more efficient and easier to read: Value *MagArg = ConstantFP::get(SelType, abs(*TC)); | |
llvm/test/Transforms/InstCombine/select.ll | ||
1703–1704 | Test coverage would be better if you vary the predicate (for example ule). Also, swap the positive and negative constants on the next test? |
LGTM - it might also be possible to allow undefs in the compare constant, but we would have to test that carefully with Alive2 to be sure.
This might be more efficient and easier to read: