[PATCH] D33446: [ARM] Temporarily disable globals promotion to constant pools to prevent miscompilation

Oleg Ranevskyy via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 23 09:11:42 PDT 2017


iid_iunknown created this revision.
Herald added subscribers: javed.absar, aemerson.

A temporary workaround for PR32780 - rematerialized instructions accessing the same promoted global through different constant pool entries.

The patch turns off the globals promotion optimization leaving all its code in place, so that it can be easily turned on once PR32780 is fixed.

Since this is a miscompilation issue causing generation of misbehaving code, and the problem is very subtle, the patch might be valuable enough to get into 4.0.1.


Repository:
  rL LLVM

https://reviews.llvm.org/D33446

Files:
  lib/Target/ARM/ARMISelLowering.cpp
  test/CodeGen/ARM/constantpool-promote-dbg.ll
  test/CodeGen/ARM/constantpool-promote-ldrh.ll
  test/CodeGen/ARM/constantpool-promote.ll


Index: test/CodeGen/ARM/constantpool-promote.ll
===================================================================
--- test/CodeGen/ARM/constantpool-promote.ll
+++ test/CodeGen/ARM/constantpool-promote.ll
@@ -45,6 +45,9 @@
 ; CHECK-LABEL: @test3
 ; CHECK: adr r0, [[x:.*]]
 ; CHECK: [[x]]:
+; Temporarily XFAIL'ed until PR32780 gets resolved.
+; FIXME: remove XFAIL once PR32780 is fixed.
+; XFAIL: *
 ; CHECK: .asciz "this string is just right!\000"
 define void @test3() #0 {
   tail call void @a(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str2, i32 0, i32 0)) #2
Index: test/CodeGen/ARM/constantpool-promote-ldrh.ll
===================================================================
--- test/CodeGen/ARM/constantpool-promote-ldrh.ll
+++ test/CodeGen/ARM/constantpool-promote-ldrh.ll
@@ -1,3 +1,6 @@
+; Temporarily XFAIL'ed until PR32780 gets resolved.
+; FIXME: remove XFAIL once PR32780 is fixed.
+; XFAIL: *
 ; RUN: llc < %s -O0 -fast-isel=false | FileCheck %s
 ; RUN: llc < %s -O0 -fast-isel=false -filetype=obj
 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
Index: test/CodeGen/ARM/constantpool-promote-dbg.ll
===================================================================
--- test/CodeGen/ARM/constantpool-promote-dbg.ll
+++ test/CodeGen/ARM/constantpool-promote-dbg.ll
@@ -1,3 +1,6 @@
+; Temporarily XFAIL'ed until PR32780 gets resolved.
+; FIXME: remove XFAIL once PR32780 is fixed.
+; XFAIL: *
 ; RUN: llc -relocation-model=static < %s | FileCheck %s
 
 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
Index: lib/Target/ARM/ARMISelLowering.cpp
===================================================================
--- lib/Target/ARM/ARMISelLowering.cpp
+++ lib/Target/ARM/ARMISelLowering.cpp
@@ -3132,9 +3132,12 @@
   bool IsRO = isReadOnly(GV);
 
   // promoteToConstantPool only if not generating XO text section
-  if (TM.shouldAssumeDSOLocal(*GV->getParent(), GV) && !Subtarget->genExecuteOnly())
+  // Temporarily disable promotion of constant globals to constant pools until
+  // PR32780 gets resolved.
+  // FIXME: uncomment once PR32780 is fixed.
+  /*if (TM.shouldAssumeDSOLocal(*GV->getParent(), GV) && !Subtarget->genExecuteOnly())
     if (SDValue V = promoteToConstantPool(GV, DAG, PtrVT, dl))
-      return V;
+      return V;*/
 
   if (isPositionIndependent()) {
     bool UseGOT_PREL = !TM.shouldAssumeDSOLocal(*GV->getParent(), GV);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33446.99926.patch
Type: text/x-patch
Size: 2458 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170523/5b7b28b5/attachment.bin>


More information about the llvm-commits mailing list