<div dir="ltr">GlobalsModRef was giving a spurious alias analysis result because it failed to consider that atomics access memory. The attached patch fixes that (PR23345).<div><br><div>I reduced this from a "compare and swap" loop that looked funny in the machine code: the "compare and swap" had in fact been hoisted out of the loop. I only ran into this when I tried `-flto -O2 -fno-inline`.</div></div><div><br></div><div>The structure of the test is pretty closely copied from one of the others in the directory. Any better ideas for testing this (or ways to make the testing more thorough) would be appreciated.</div><div><br></div><div>If somebody can doublecheck that these are the only missing cases, that would be appreciated. This loop been touched since 2012 and I'm relatively clueless about AA. Hopefully this patch also suggests a couple other places to audit for similar bugs to those with a better "big picture" of the IR analysis and transforms than myself.</div><div><br></div><div>-- Sean Silva</div></div>