[llvm] r262907 - Fix evaluation order. Spotted by Alexander Riccio!

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 7 20:38:50 PST 2016


Does this demonstrate some missing test coverage?

Or does this code have the same semantics either way (& possibly the same
semantics as just "if (Target.RetVal == IsOne)"?)

On Mon, Mar 7, 2016 at 7:50 PM, Peter Collingbourne via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: pcc
> Date: Mon Mar  7 21:50:36 2016
> New Revision: 262907
>
> URL: http://llvm.org/viewvc/llvm-project?rev=262907&view=rev
> Log:
> Fix evaluation order. Spotted by Alexander Riccio!
>
> Modified:
>     llvm/trunk/lib/Transforms/IPO/WholeProgramDevirt.cpp
>
> Modified: llvm/trunk/lib/Transforms/IPO/WholeProgramDevirt.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/WholeProgramDevirt.cpp?rev=262907&r1=262906&r2=262907&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Transforms/IPO/WholeProgramDevirt.cpp (original)
> +++ llvm/trunk/lib/Transforms/IPO/WholeProgramDevirt.cpp Mon Mar  7
> 21:50:36 2016
> @@ -459,7 +459,7 @@ bool DevirtModule::tryUniqueRetValOpt(
>    auto tryUniqueRetValOptFor = [&](bool IsOne) {
>      const BitSetInfo *UniqueBitSet = 0;
>      for (const VirtualCallTarget &Target : TargetsForSlot) {
> -      if (Target.RetVal == IsOne ? 1 : 0) {
> +      if (Target.RetVal == (IsOne ? 1 : 0)) {
>          if (UniqueBitSet)
>            return false;
>          UniqueBitSet = Target.BS;
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160307/4efb350a/attachment.html>


More information about the llvm-commits mailing list