[PATCH] D81632: Fix undefined behavior in PeepholeOptimizer.

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 16 13:12:20 PDT 2020


arsenm added a comment.

In D81632#2096458 <https://reviews.llvm.org/D81632#2096458>, @void wrote:

> In D81632#2094672 <https://reviews.llvm.org/D81632#2094672>, @linzj wrote:
>
> > > Which platform did you run valgrind on? The x86 platform should set SubIdx on all paths through it...
> >
> > ARM. armv8-linux-android.
>
>
> Strange. SubIdx is initialized on all paths that return `true` in that function. So I'm not sure why valgrind complained...
>
> My one worry with the change in this patch is that `0` is ostensibly a valid index, right? So how do we distinguish it from an invalid one if `isCoalescableExtInstr` returns `true` without properly initializing SubIdx?


No, NoSubRegister is defined as 0


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81632/new/

https://reviews.llvm.org/D81632





More information about the llvm-commits mailing list