[llvm-commits] X*log2(Y*0.5)->X*log2(Y)-X (under fast math)
Evan Cheng
evan.cheng at apple.com
Mon Dec 3 10:09:55 PST 2012
+ if (Op0->hasOneUse()) {
+ if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(Op0)) {
+ if (II->getIntrinsicID() == Intrinsic::log2 &&
+ II->hasUnsafeAlgebra())
+ {
Please be consistent and put the curly braces after the parentheses.
Also,
+ if (Op0->hasOneUse()) {
+ if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(Op0)) {
+ if (II->getIntrinsicID() == Intrinsic::log2 &&
+ II->hasUnsafeAlgebra())
+ {
...
+ if (Op1->hasOneUse()) {
+ if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(Op1)) {
+ if (II->getIntrinsicID() == Intrinsic::log2 &&
+ II->hasUnsafeAlgebra())
+ {
It looks like the code segments inside these two conditions are the same. Please factor it out into a function to avoid code duplication and use early exits to reduce indentation.
Thanks,
Evan
On Nov 30, 2012, at 9:39 AM, Pedro Artigas <partigas at apple.com> wrote:
> Hello All,
>
> This patch implements the above algebra transform under fast math flag.
>
> Thanks
>
> Pedro Artigas
>
> <patch.txt>_______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list