[llvm-branch-commits] [llvm-branch] r296002 - Merging r295762:

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Feb 23 10:39:15 PST 2017


Author: hans
Date: Thu Feb 23 12:39:15 2017
New Revision: 296002

URL: http://llvm.org/viewvc/llvm-project?rev=296002&view=rev
Log:
Merging r295762:
------------------------------------------------------------------------
r295762 | eugenis | 2017-02-21 12:17:34 -0800 (Tue, 21 Feb 2017) | 3 lines

Fix PR31896.

Address of an alias of a global with offset is incorrectly lowered as an address of the global (i.e. ignoring offset).
------------------------------------------------------------------------

Added:
    llvm/branches/release_40/test/CodeGen/ARM/alias_store.ll
      - copied unchanged from r295762, llvm/trunk/test/CodeGen/ARM/alias_store.ll
Modified:
    llvm/branches/release_40/   (props changed)
    llvm/branches/release_40/lib/Target/ARM/ARMISelLowering.cpp

Propchange: llvm/branches/release_40/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Feb 23 12:39:15 2017
@@ -1,3 +1,3 @@
 /llvm/branches/Apple/Pertwee:110850,110961
 /llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,291858-291859,291863,291875,291909,291918,291966,291968,291979,292117,292133,292167,292169-292170,292242,292254-292255,292280,292323,292444,292467,292516,292583,292624-292625,292641,292651,292667,292711-292713,292758,292949,293017,293021,293025,293124,293230,293259,293273,293291,293293,293309,293345,293417,293522,293542,293629,293635,293658,293673,293727,293730,294003,294102,294129,294203,294267,294318,294348-294349,294357,294527,294551,294982,295018,295213,295215,295230,295486,295490,295512
+/llvm/trunk:155241,291858-291859,291863,291875,291909,291918,291966,291968,291979,292117,292133,292167,292169-292170,292242,292254-292255,292280,292323,292444,292467,292516,292583,292624-292625,292641,292651,292667,292711-292713,292758,292949,293017,293021,293025,293124,293230,293259,293273,293291,293293,293309,293345,293417,293522,293542,293629,293635,293658,293673,293727,293730,294003,294102,294129,294203,294267,294318,294348-294349,294357,294527,294551,294982,295018,295213,295215,295230,295486,295490,295512,295762

Modified: llvm/branches/release_40/lib/Target/ARM/ARMISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_40/lib/Target/ARM/ARMISelLowering.cpp?rev=296002&r1=296001&r2=296002&view=diff
==============================================================================
--- llvm/branches/release_40/lib/Target/ARM/ARMISelLowering.cpp (original)
+++ llvm/branches/release_40/lib/Target/ARM/ARMISelLowering.cpp Thu Feb 23 12:39:15 2017
@@ -3027,17 +3027,20 @@ static SDValue promoteToConstantPool(con
   return DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr);
 }
 
+static bool isReadOnly(const GlobalValue *GV) {
+  if (const GlobalAlias *GA = dyn_cast<GlobalAlias>(GV))
+    GV = GA->getBaseObject();
+  return (isa<GlobalVariable>(GV) && cast<GlobalVariable>(GV)->isConstant()) ||
+         isa<Function>(GV);
+}
+
 SDValue ARMTargetLowering::LowerGlobalAddressELF(SDValue Op,
                                                  SelectionDAG &DAG) const {
   EVT PtrVT = getPointerTy(DAG.getDataLayout());
   SDLoc dl(Op);
   const GlobalValue *GV = cast<GlobalAddressSDNode>(Op)->getGlobal();
   const TargetMachine &TM = getTargetMachine();
-  if (const GlobalAlias *GA = dyn_cast<GlobalAlias>(GV))
-    GV = GA->getBaseObject();
-  bool IsRO =
-      (isa<GlobalVariable>(GV) && cast<GlobalVariable>(GV)->isConstant()) ||
-      isa<Function>(GV);
+  bool IsRO = isReadOnly(GV);
 
   // promoteToConstantPool only if not generating XO text section
   if (TM.shouldAssumeDSOLocal(*GV->getParent(), GV) && !Subtarget->genExecuteOnly())




More information about the llvm-branch-commits mailing list