Fix the issue of duplicating the call to exp{,2}() when it's nested in pow(), as exposed by rL340462.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
It isn't obvious why this case is different than the other transforms, so some code comments are needed.
- We can't rely on dead code elimination because libcalls may not be readnone (ie, they may set errno).
- The calling code in LibCallSimplifier and InstCombine handles erasing the called function itself in all cases.
- In this transform, we're potentially eliminating the intermediate exp2 call, so we have to manually kill it.
But what happens if the exp2 call has another use besides the pow call? We need a test for that scenario.
Comment Actions
The function pow_exp2_libcall() in the test case is one such example without readnone. I'll augment the test case with a reuse scenario.