Yes, I added one yesterday (r257280).<span></span><br><br>On Sunday, January 10, 2016, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">any way to test this?</div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jan 9, 2016 at 11:13 PM, David Majnemer via llvm-commits <span dir="ltr"><<a href="javascript:_e(%7B%7D,'cvml','llvm-commits@lists.llvm.org');" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: majnemer<br>
Date: Sun Jan 10 01:13:04 2016<br>
New Revision: 257279<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=257279&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=257279&view=rev</a><br>
Log:<br>
[JumpThreading] Don't forget to report that the IR changed<br>
<br>
JumpThreading's runOnFunction is supposed to return true if it made any<br>
changes. JumpThreading has a call to removeUnreachableBlocks which may<br>
result in changes to the IR but runOnFunction didn't appropriate account<br>
for this possibility, leading to badness.<br>
<br>
While we are here, make sure to call LazyValueInfo::eraseBlock in<br>
removeUnreachableBlocks; JumpThreading preserves LVI.<br>
<br>
This fixes PR26096.<br>
<br>
Modified:<br>
llvm/trunk/include/llvm/Transforms/Utils/Local.h<br>
llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp<br>
llvm/trunk/lib/Transforms/Utils/Local.cpp<br>
<br>
Modified: llvm/trunk/include/llvm/Transforms/Utils/Local.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/Local.h?rev=257279&r1=257278&r2=257279&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/Local.h?rev=257279&r1=257278&r2=257279&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/Transforms/Utils/Local.h (original)<br>
+++ llvm/trunk/include/llvm/Transforms/Utils/Local.h Sun Jan 10 01:13:04 2016<br>
@@ -42,6 +42,7 @@ class TargetLibraryInfo;<br>
class TargetTransformInfo;<br>
class DIBuilder;<br>
class DominatorTree;<br>
+class LazyValueInfo;<br>
<br>
template<typename T> class SmallVectorImpl;<br>
<br>
@@ -303,7 +304,7 @@ void removeUnwindEdge(BasicBlock *BB);<br>
/// \brief Remove all blocks that can not be reached from the function's entry.<br>
///<br>
/// Returns true if any basic block was removed.<br>
-bool removeUnreachableBlocks(Function &F);<br>
+bool removeUnreachableBlocks(Function &F, LazyValueInfo *LVI = nullptr);<br>
<br>
/// \brief Combine the metadata of two instructions so that K can replace J<br>
///<br>
<br>
Modified: llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp?rev=257279&r1=257278&r2=257279&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp?rev=257279&r1=257278&r2=257279&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp (original)<br>
+++ llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp Sun Jan 10 01:13:04 2016<br>
@@ -211,11 +211,12 @@ bool JumpThreading::runOnFunction(Functi<br>
// we will loop forever. We take care of this issue by not jump threading for<br>
// back edges. This works for normal cases but not for unreachable blocks as<br>
// they may have cycle with no back edge.<br>
- removeUnreachableBlocks(F);<br>
+ bool EverChanged = false;<br>
+ EverChanged |= removeUnreachableBlocks(F, LVI);<br>
<br>
FindLoopHeaders(F);<br>
<br>
- bool Changed, EverChanged = false;<br>
+ bool Changed;<br>
do {<br>
Changed = false;<br>
for (Function::iterator I = F.begin(), E = F.end(); I != E;) {<br>
<br>
Modified: llvm/trunk/lib/Transforms/Utils/Local.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/Local.cpp?rev=257279&r1=257278&r2=257279&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/Local.cpp?rev=257279&r1=257278&r2=257279&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Transforms/Utils/Local.cpp (original)<br>
+++ llvm/trunk/lib/Transforms/Utils/Local.cpp Sun Jan 10 01:13:04 2016<br>
@@ -23,6 +23,7 @@<br>
#include "llvm/Analysis/EHPersonalities.h"<br>
#include "llvm/Analysis/InstructionSimplify.h"<br>
#include "llvm/Analysis/MemoryBuiltins.h"<br>
+#include "llvm/Analysis/LazyValueInfo.h"<br>
#include "llvm/Analysis/ValueTracking.h"<br>
#include "llvm/IR/CFG.h"<br>
#include "llvm/IR/Constants.h"<br>
@@ -1407,7 +1408,7 @@ void llvm::removeUnwindEdge(BasicBlock *<br>
/// removeUnreachableBlocksFromFn - Remove blocks that are not reachable, even<br>
/// if they are in a dead cycle. Return true if a change was made, false<br>
/// otherwise.<br>
-bool llvm::removeUnreachableBlocks(Function &F) {<br>
+bool llvm::removeUnreachableBlocks(Function &F, LazyValueInfo *LVI) {<br>
SmallPtrSet<BasicBlock*, 128> Reachable;<br>
bool Changed = markAliveBlocks(F, Reachable);<br>
<br>
@@ -1428,6 +1429,8 @@ bool llvm::removeUnreachableBlocks(Funct<br>
++SI)<br>
if (Reachable.count(*SI))<br>
(*SI)->removePredecessor(&*BB);<br>
+ if (LVI)<br>
+ LVI->eraseBlock(&*BB);<br>
BB->dropAllReferences();<br>
}<br>
<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="javascript:_e(%7B%7D,'cvml','llvm-commits@lists.llvm.org');" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>
</blockquote>