[PATCH] fix incorrect codegen from instcombine (PR17827)
Evan Cheng
evan.cheng at apple.com
Thu Nov 21 17:34:57 PST 2013
I looked at the analysis in the bug report and I think I agree with your assessment. Perhaps you can use Nuno's technique to verify the optimization with a SMT solver?
As for the patch itself, (assuming the analysis is correct), the patch is trivially correct. The only adjustment I would make is mechanical:
+ } else { // logical shift left or right
+ if (Shift->getOpcode() == Instruction::Shl) {
+ CanFold = Shift->hasNoSignedWrap() || !ICI.isSigned();
+ } else { // logical shift right
+ CanFold = true;
+ }
}
I would have combined the else and the first if to
} else if (Shift->getOpcode() == Instruction::Shl) {
Evan
On Nov 21, 2013, at 11:46 AM, Kay Tiong Khoo <kkhoo at perfwizard.com> wrote:
> Detailed description of problem in instcombine's compare optimizer:
> http://llvm.org/bugs/show_bug.cgi?id=17827
>
> Fix suggested by Henrique Santos via dev mailing list:
> http://lists.cs.uiuc.edu/pipermail/llvmdev/2013-November/067822.html
> <pr17827.patch>_______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131121/e5cd539c/attachment.html>
More information about the llvm-commits
mailing list