[PATCH] D25969: [AliasSetTracker] Make AST smarter about intrinsics that don't actually affect memory.

Chad Rosier via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 26 12:28:20 PDT 2016


mcrosier added a comment.

In https://reviews.llvm.org/D25969#580042, @mcrosier wrote:

> In https://reviews.llvm.org/D25969#579967, @nemanjai wrote:
>
> > This caused a failure on all PPC machines I have access to:
> >  AddressSanitizer-powerpc64le-linux :: TestCases/use-after-scope-loop-bug.cc
>
>
> Looking now..


I believe I've figured out the underlying problem.  In short, LICM is relying on lifetime markers to prevent loads/stores from being moved out of a particular scope.

From the broken test case:
int main() {

  // Variable goes in and out of scope.
  for (int i = 0; i < 3; ++i) {
    int x[3] = {i, i, i};
    p = x + i;
  }
  return *p;  // BOOM

}

LICM will sink the stores to x[3] after the loop, which is obviously incorrect.  I've reverted the change in r285227.  Sorry for the breakage.


Repository:
  rL LLVM

https://reviews.llvm.org/D25969





More information about the llvm-commits mailing list