x / fabs(x) -> copysign(1.0, x)
fabs(x) / x -> copysign(1.0, x)
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/Transforms/InstCombine/InstCombineMulDivRem.cpp | ||
---|---|---|
1237 ↗ | (On Diff #214218) | Do we want to handle the commuted pattern too? |
1240 ↗ | (On Diff #214218) | Do we need the one-use restriction? |
test/Transforms/InstCombine/fabs-copysign.ll | ||
43 ↗ | (On Diff #214218) | This is supposed to be an extra use test, but there's no extra use? |
lib/Transforms/InstCombine/InstCombineMulDivRem.cpp | ||
---|---|---|
1240 ↗ | (On Diff #214218) | Dropped. |
lib/Transforms/InstCombine/InstCombineMulDivRem.cpp | ||
---|---|---|
1246 ↗ | (On Diff #214378) | I tried match(&I, m_FDiv(m_Value(X), m_Intrinsic<Intrinsic::fabs>(m_Specific(X)))) and it failed to match.. uh. (this blocked me to possibly introduce m_c_FDiv) |
lib/Transforms/InstCombine/InstCombineMulDivRem.cpp | ||
---|---|---|
1246 ↗ | (On Diff #214378) | You need to use m_Deferred() for that case when matching commutatively (cc @lebedev.ri ). |
test/Transforms/InstCombine/fabs-copysign.ll | ||
21–29 ↗ | (On Diff #214378) | Please push the new tests with baseline CHECKs as a preliminary step. |
lib/Transforms/InstCombine/InstCombineMulDivRem.cpp | ||
---|---|---|
1246 ↗ | (On Diff #214378) | Thanks! (and agree) |
Wait - there was a vector test here at 1 point, but now it's gone? Please adjust the type on one of the positive tests, so we still have that coverage.