[llvm-branch-commits] [llvm-branch] r244652 - Merging r244418:

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Aug 11 13:01:27 PDT 2015


Author: hans
Date: Tue Aug 11 15:01:26 2015
New Revision: 244652

URL: http://llvm.org/viewvc/llvm-project?rev=244652&view=rev
Log:
Merging r244418:
------------------------------------------------------------------------
r244418 | majnemer | 2015-08-09 08:43:02 -0700 (Sun, 09 Aug 2015) | 10 lines

[PHITransAddr] Don't assume that instruction operands are translatable

We can only PHI translate instructions.  In our attempt to PHI translate
a bitcast, we attempt to translate its operand; however, the operand
might be an argument or a global instead of an instruction.  Benignly
bail out when this happens.

This fixes PR24397.

Differential Revision: http://reviews.llvm.org/D11879
------------------------------------------------------------------------

Added:
    llvm/branches/release_37/test/Transforms/GVN/pr24397.ll
      - copied unchanged from r244418, llvm/trunk/test/Transforms/GVN/pr24397.ll
Modified:
    llvm/branches/release_37/   (props changed)
    llvm/branches/release_37/lib/Analysis/PHITransAddr.cpp

Propchange: llvm/branches/release_37/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Aug 11 15:01:26 2015
@@ -1,3 +1,3 @@
 /llvm/branches/Apple/Pertwee:110850,110961
 /llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,242236,242239,242281,242288,242296,242331,242341,242410,242412,242433-242434,242442,242543,242673,242680,242706,242721-242722,242733-242735,242742,242869,242919,242993,243001,243057,243116,243263,243294,243361,243469,243485,243500,243519,243531,243589,243609,243636,243638-243640,243745,243898,243927,243932,243934,243984,243986,244058,244123,244554
+/llvm/trunk:155241,242236,242239,242281,242288,242296,242331,242341,242410,242412,242433-242434,242442,242543,242673,242680,242706,242721-242722,242733-242735,242742,242869,242919,242993,243001,243057,243116,243263,243294,243361,243469,243485,243500,243519,243531,243589,243609,243636,243638-243640,243745,243898,243927,243932,243934,243984,243986,244058,244123,244418,244554

Modified: llvm/branches/release_37/lib/Analysis/PHITransAddr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_37/lib/Analysis/PHITransAddr.cpp?rev=244652&r1=244651&r2=244652&view=diff
==============================================================================
--- llvm/branches/release_37/lib/Analysis/PHITransAddr.cpp (original)
+++ llvm/branches/release_37/lib/Analysis/PHITransAddr.cpp Tue Aug 11 15:01:26 2015
@@ -374,9 +374,10 @@ InsertPHITranslatedSubExpr(Value *InVal,
   if (!Tmp.PHITranslateValue(CurBB, PredBB, &DT, /*MustDominate=*/true))
     return Tmp.getAddr();
 
-  // If we don't have an available version of this value, it must be an
-  // instruction.
-  Instruction *Inst = cast<Instruction>(InVal);
+  // We don't need to PHI translate values which aren't instructions.
+  auto *Inst = dyn_cast<Instruction>(InVal);
+  if (!Inst)
+    return nullptr;
 
   // Handle cast of PHI translatable value.
   if (CastInst *Cast = dyn_cast<CastInst>(Inst)) {




More information about the llvm-branch-commits mailing list