summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp4
-rw-r--r--llvm/test/ThinLTO/X86/Inputs/autoupgrade.bcbin0 -> 1024 bytes
-rw-r--r--llvm/test/ThinLTO/X86/autoupgrade.ll23
3 files changed, 26 insertions, 1 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 9bb8b2f50bb..3084410f700 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -3682,7 +3682,9 @@ std::error_code BitcodeReader::parseModule(uint64_t ResumeBit,
// have been seen yet. In this case, just finish the parse now.
if (SeenValueSymbolTable) {
NextUnreadBit = Stream.GetCurrentBitNo();
- return std::error_code();
+ // After the VST has been parsed, we need to make sure intrinsic name
+ // are auto-upgraded.
+ return globalCleanup();
}
break;
case bitc::USELIST_BLOCK_ID:
diff --git a/llvm/test/ThinLTO/X86/Inputs/autoupgrade.bc b/llvm/test/ThinLTO/X86/Inputs/autoupgrade.bc
new file mode 100644
index 00000000000..578b33796fa
--- /dev/null
+++ b/llvm/test/ThinLTO/X86/Inputs/autoupgrade.bc
Binary files differ
diff --git a/llvm/test/ThinLTO/X86/autoupgrade.ll b/llvm/test/ThinLTO/X86/autoupgrade.ll
new file mode 100644
index 00000000000..fd7111480f0
--- /dev/null
+++ b/llvm/test/ThinLTO/X86/autoupgrade.ll
@@ -0,0 +1,23 @@
+; Verify that auto-upgrading intrinsics works with Lazy loaded bitcode
+; Do setup work for all below tests: generate bitcode and combined index
+; RUN: opt -module-summary %s -o %t.bc
+; RUN: llvm-lto -thinlto-action=thinlink -o %t3.bc %t.bc %p/Inputs/autoupgrade.bc
+
+; RUN: llvm-lto -thinlto-action=import %t.bc -thinlto-index=%t3.bc -o - | llvm-bcanalyzer -dump | FileCheck %s
+
+; We can't use llvm-dis here, because it would do the autoupgrade itself.
+
+; CHECK-NOT: 'llvm.invariant.start'
+; CHECK: record string = 'llvm.invariant.start.p0i8'
+; CHECK-NOT: 'llvm.invariant.start'
+
+target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-apple-macosx10.11.0"
+
+define i32 @main() #0 {
+entry:
+ call void (...) @globalfunc1()
+ ret i32 0
+}
+
+declare void @globalfunc1(...) #1
OpenPOWER on IntegriCloud