<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hey David<div class=""><br class=""></div><div class="">Thanks for letting me know, and analysing it this far!</div><div class=""><br class=""></div><div class="">I also can't see anything wrong with the intrinsic.  Its just defined as:</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class="">def int_objc_autoreleasePoolPop             : Intrinsic<[], [llvm_ptr_ty]>;</div></blockquote><div class=""><br class=""></div><div class="">which (I believe) means it has unmodelled side effects so it should have been fine for your example.</div><div class=""><br class=""></div><div class="">I'll try build the same file you did and see if I can reproduce.</div><div class=""><br class=""></div><div class="">Cheers,</div><div class="">Pete<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Feb 24, 2019, at 7:48 AM, David Chisnall via Phabricator <<a href="mailto:reviews@reviews.llvm.org" class="">reviews@reviews.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">theraven added a comment.<br class="">Herald added a project: LLVM.<br class=""><br class="">After some bisection, it appears that this is the revision that introduced the regression in the GNUstep Objective-C runtime test suite that I reported on the list a few weeks ago.  In this is the test (compiled with `-fobjc-runtime=gnustep-2.0 -O3` and an ELF triple):<br class=""><br class=""><a href="https://github.com/gnustep/libobjc2/blob/master/Test/AssociatedObject.m" class="">https://github.com/gnustep/libobjc2/blob/master/Test/AssociatedObject.m</a><br class=""><br class="">After this change, Early CSE w/ MemorySSA is determining that the second load of `deallocCalled` is redundant.  The code goes from:<br class=""><br class="">    %7 = load i1, i1* @deallocCalled, align 1<br class="">    br i1 %7, label %8, label %9<br class=""><br class="">  ; <label>:8:                                      ; preds = %0<br class="">    call void @__assert(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @__func__.main, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 26, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0)) #5<br class="">    unreachable<br class=""><br class="">  ; <label>:9:                                      ; preds = %0<br class="">    call void @llvm.objc.autoreleasePoolPop(i8* %1)<br class="">    %10 = load i1, i1* @deallocCalled, align 1<br class="">    br i1 %10, label %12, label %11<br class=""><br class="">  ; <label>:11:                                     ; preds = %9<br class="">    call void @__assert(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @__func__.main, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 29, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0)) #5<br class="">    unreachable<br class=""><br class="">to:<br class=""><br class="">    %7 = load i1, i1* @deallocCalled, align 1<br class="">    br i1 %7, label %8, label %9<br class=""><br class="">  ; <label>:8:                                      ; preds = %0<br class="">    call void @__assert(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @__func__.main, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 26, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0)) #5<br class="">    unreachable<br class=""><br class="">  ; <label>:9:                                      ; preds = %0<br class="">    call void @llvm.objc.autoreleasePoolPop(i8* %1)<br class="">    br i1 %7, label %11, label %10<br class=""><br class="">  ; <label>:10:                                     ; preds = %9<br class="">    call void @__assert(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @__func__.main, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 29, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0)) #5<br class="">    unreachable<br class=""><br class="">Later optimisations then determine that, because the assert does not return, the only possible value for %7 is false and cause the second assert to fire unconditionally.<br class=""><br class="">It appears that we are not correctly modelling the side effects of the `llvm.objc.autoreleasePoolPop` intrinsic, but it's not entirely clear why not.  The same test compiled for the macos runtime does not appear to exhibit the same behaviour.  The previous revision, where we emitted a call to `objc_autoreleasePoolPop` and not the intrinsic worked correctly, but with this change the optimisers are assuming that no globals can be modified across an autorelease pool pop operation (at least, in some situations).<br class=""><br class="">Looking at the definition of the intrinsic, I don't see anything wrong, so I still suspect that there is a MemorySSA bug that this has uncovered, rather than anything wrong in this series of commits.  Any suggestions as to where to look would be appreciated.<br class=""><br class=""><br class="">Repository:<br class="">  rL LLVM<br class=""><br class="">CHANGES SINCE LAST ACTION<br class="">  https://reviews.llvm.org/D55802/new/<br class=""><br class="">https://reviews.llvm.org/D55802<br class=""><br class=""><br class=""><br class=""></div></div></blockquote></div><br class=""></div></body></html>