[llvm] r302450 - [ARM] Use a Changed flag to avoid making a pass's return value dependent on a compare with a Statistic object.
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Mon May 15 09:32:45 PDT 2017
Any chance of easy/practical test coverage for this? (eg: is there a way to
get opt to run the same pass twice in one go? should there be?)
On Mon, May 8, 2017 at 11:15 AM Craig Topper via llvm-commits <
llvm-commits at lists.llvm.org> wrote:
> Author: ctopper
> Date: Mon May 8 13:02:51 2017
> New Revision: 302450
>
> URL: http://llvm.org/viewvc/llvm-project?rev=302450&view=rev
> Log:
> [ARM] Use a Changed flag to avoid making a pass's return value dependent
> on a compare with a Statistic object.
>
> Statistic compile to always be 0 in release build so this compare would
> always return false. And in the debug builds Statistic are global variables
> and remember their values across pass runs. So this compare returns true
> anytime the pass runs after the first time it modifies something.
>
> This was found after reviewing all usages of comparison operators on a
> Statistic object. We had some internal code that did a compare with a
> statistic that caused a mismatch in output between debug and release
> builds. So we did an audit out of paranoia.
>
> Modified:
> llvm/trunk/lib/Target/ARM/ARMOptimizeBarriersPass.cpp
>
> Modified: llvm/trunk/lib/Target/ARM/ARMOptimizeBarriersPass.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMOptimizeBarriersPass.cpp?rev=302450&r1=302449&r2=302450&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Target/ARM/ARMOptimizeBarriersPass.cpp (original)
> +++ llvm/trunk/lib/Target/ARM/ARMOptimizeBarriersPass.cpp Mon May 8
> 13:02:51 2017
> @@ -88,13 +88,15 @@ bool ARMOptimizeBarriersPass::runOnMachi
> }
> }
> }
> + bool Changed = false;
> // Remove the tagged DMB
> for (auto MI : ToRemove) {
> MI->eraseFromParent();
> ++NumDMBsRemoved;
> + Changed = true;
> }
>
> - return NumDMBsRemoved > 0;
> + return Changed;
> }
>
> /// createARMOptimizeBarriersPass - Returns an instance of the remove
> double
>
>
> _______________________________________________
> 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/20170515/7f2723bb/attachment.html>
More information about the llvm-commits
mailing list