[PATCH] D49273: [InstCombine] Expand the simplification of pow() into exp2()

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 28 10:20:55 PDT 2018


spatel added a comment.

Are there any negative tests where the base is not a power-of-2? If not, please add at least 1 test like that to make sure we're not transforming that.



================
Comment at: llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp:1239-1240
+  BaseR = BaseR / *BaseF;
+  bool isInteger    = BaseF->isInteger(),
+       isReciprocal = BaseR.isInteger();
+  const APFloat *NF = isReciprocal ? &BaseR : BaseF;
----------------
isInteger -> IsInteger
isReciprocal -> IsReciprocal


================
Comment at: llvm/test/Transforms/InstCombine/pow-1.ll:173
 ; ANY-LABEL: @test_simplify7(
-; ANY-NEXT:    [[SQRTF:%.*]] = call float @sqrtf(float [[X:%.*]]) [[NUW_RO:#[0-9]+]]
+; ANY-NEXT:    [[SQRTF:%.*]] = call float @sqrtf(float [[X:%.*]]) #0
 ; ANY-NEXT:    [[ABS:%.*]] = call float @llvm.fabs.f32(float [[SQRTF]])
----------------
It would be better to leave this and the similar assertions as-is because they confirm that the attribute statement actually contains the expected strings.

The update script should leave existing CHECK lines alone if you specify "--function=foo" to only change the tests that you are targeting with this patch.


https://reviews.llvm.org/D49273





More information about the llvm-commits mailing list