[llvm] r324658 - [ThinLTO] Skip BlockAddresses while replacing uses in function import.

Dmitry Mikulin via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 8 14:14:56 PST 2018


Author: dmikulin
Date: Thu Feb  8 14:14:56 2018
New Revision: 324658

URL: http://llvm.org/viewvc/llvm-project?rev=324658&view=rev
Log:
[ThinLTO] Skip BlockAddresses while replacing uses in function import.

Differential Revision: https://reviews.llvm.org/D43027

Added:
    llvm/trunk/test/Transforms/LowerTypeTests/Inputs/blockaddr-import.yaml
    llvm/trunk/test/Transforms/LowerTypeTests/blockaddr-import.ll
Modified:
    llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp

Modified: llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp?rev=324658&r1=324657&r2=324658&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp Thu Feb  8 14:14:56 2018
@@ -983,7 +983,7 @@ void LowerTypeTestsModule::importFunctio
   if (F->isWeakForLinker())
     replaceWeakDeclarationWithJumpTablePtr(F, FDecl);
   else
-    F->replaceAllUsesWith(FDecl);
+    F->replaceUsesExceptBlockAddr(FDecl);
 }
 
 void LowerTypeTestsModule::lowerTypeTestCalls(

Added: llvm/trunk/test/Transforms/LowerTypeTests/Inputs/blockaddr-import.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LowerTypeTests/Inputs/blockaddr-import.yaml?rev=324658&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/LowerTypeTests/Inputs/blockaddr-import.yaml (added)
+++ llvm/trunk/test/Transforms/LowerTypeTests/Inputs/blockaddr-import.yaml Thu Feb  8 14:14:56 2018
@@ -0,0 +1,10 @@
+---
+TypeIdMap:
+  typeid1:
+    TTRes:
+      Kind:            AllOnes
+      SizeM1BitWidth:  7
+CfiFunctionDefs:
+  - m
+CfiFunctionDecls:
+...

Added: llvm/trunk/test/Transforms/LowerTypeTests/blockaddr-import.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LowerTypeTests/blockaddr-import.ll?rev=324658&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/LowerTypeTests/blockaddr-import.ll (added)
+++ llvm/trunk/test/Transforms/LowerTypeTests/blockaddr-import.ll Thu Feb  8 14:14:56 2018
@@ -0,0 +1,22 @@
+; RUN: opt -lowertypetests -lowertypetests-summary-action=import -lowertypetests-read-summary=%p/Inputs/blockaddr-import.yaml %s -S | FileCheck %s
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux"
+
+declare i1 @llvm.type.test(i8*, metadata) #1
+declare !type !11 i32 @o(...)
+
+define hidden void @m() #0 !type !3 {
+entry:
+  br label %n
+n:
+  %call = tail call i32 (i8*, ...) bitcast (i32 (...)* @o to i32 (i8*, ...)*)(i8* blockaddress(@m, %n)) #4
+; Make sure that blockaddress refers to the new function, m.cfi
+; CHECK: define hidden void @m.cfi()
+; CHECK: blockaddress(@m.cfi, %n)
+
+  ret void
+}
+
+!3 = !{i64 0, !"_ZTSFvE"}
+!11 = !{i64 0, !"_ZTSFiE"}




More information about the llvm-commits mailing list