<div dir="ltr">Can we get this merged in?<br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 31, 2017 at 10:47 AM, David Majnemer via llvm-commits <span dir="ltr"><<a href="mailto: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: Mon Jul 31 10:47:07 2017<br>
New Revision: 309594<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=309594&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject?rev=309594&view=rev</a><br>
Log:<br>
[IPSCCP] Guard a user of getInitializer with hasDefinitiveInitializer<br>
<br>
We are not allowed to reason about an initializer value without first<br>
consulting hasDefinitiveInitializer.<br>
<br>
Added:<br>
llvm/trunk/test/Transforms/SCC<wbr>P/definite-initializer.ll<br>
Modified:<br>
llvm/trunk/lib/Transforms/Scal<wbr>ar/SCCP.cpp<br>
<br>
Modified: llvm/trunk/lib/Transforms/Scal<wbr>ar/SCCP.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SCCP.cpp?rev=309594&r1=309593&r2=309594&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/llvm/trunk/lib/Transform<wbr>s/Scalar/SCCP.cpp?rev=309594&<wbr>r1=309593&r2=309594&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/Transforms/Scal<wbr>ar/SCCP.cpp (original)<br>
+++ llvm/trunk/lib/Transforms/Scal<wbr>ar/SCCP.cpp Mon Jul 31 10:47:07 2017<br>
@@ -1790,7 +1790,8 @@ static bool runIPSCCP(Module &M, const D<br>
// variables that do not have their 'addresses taken'. If they don't have<br>
// their addresses taken, we can propagate constants through them.<br>
for (GlobalVariable &G : M.globals())<br>
- if (!G.isConstant() && G.hasLocalLinkage() && !AddressIsTaken(&G))<br>
+ if (!G.isConstant() && G.hasLocalLinkage() &&<br>
+ G.hasDefinitiveInitializer() && !AddressIsTaken(&G))<br>
Solver.TrackValueOfGlobalVari<wbr>able(&G);<br>
<br>
// Solve for constants.<br>
<br>
Added: llvm/trunk/test/Transforms/SCC<wbr>P/definite-initializer.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SCCP/definite-initializer.ll?rev=309594&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/llvm/trunk/test/Transfor<wbr>ms/SCCP/definite-initializer.<wbr>ll?rev=309594&view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/test/Transforms/SCC<wbr>P/definite-initializer.ll (added)<br>
+++ llvm/trunk/test/Transforms/SCC<wbr>P/definite-initializer.ll Mon Jul 31 10:47:07 2017<br>
@@ -0,0 +1,11 @@<br>
+; RUN: opt -S -ipsccp < %s | FileCheck %s<br>
+@d = internal externally_initialized global i32 0, section ".openbsd.randomdata", align 4<br>
+<br>
+; CHECK-LABEL: @test1(<br>
+define i32 @test1() {<br>
+entry:<br>
+ %load = load i32, i32* @d, align 4<br>
+ ret i32 %load<br>
+; CHECK: %[[load:.*]] = load i32, i32* @d, align 4<br>
+; CHECK: ret i32 %[[load]]<br>
+}<br>
<br>
<br>
______________________________<wbr>_________________<br>
llvm-commits mailing list<br>
<a href="mailto: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/<wbr>mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div>