llvm.org GIT mirror llvm / 5ae6e90
PMB: Run the whole-program-devirt pass during LTO at --lto-O0. The whole-program-devirt pass needs to run at -O0 because only it knows about the llvm.type.checked.load intrinsic: it needs to both lower the intrinsic itself and handle it in the summary. Differential Revision: https://reviews.llvm.org/D33571 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304019 91177308-0d34-0410-b5e6-96231b3b80d8 Peter Collingbourne 3 years ago
2 changed file(s) with 22 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
912912
913913 if (OptLevel != 0)
914914 addLTOOptimizationPasses(PM);
915 else {
916 // The whole-program-devirt pass needs to run at -O0 because only it knows
917 // about the llvm.type.checked.load intrinsic: it needs to both lower the
918 // intrinsic itself and handle it in the summary.
919 PM.add(createWholeProgramDevirtPass(ExportSummary, nullptr));
920 }
915921
916922 // Create a function that performs CFI checks for cross-DSO calls with targets
917923 // in the current module.
0 ; RUN: llvm-as -o %t %s
1 ; RUN: llvm-lto2 run %t -O0 -r %t,foo,px -o %t2
2
3 ; This just tests that we don't crash when compiling this test case.
4 ; It means that the wholeprogramdevirt pass must have run and lowered
5 ; the llvm.type.checked.load call.
6
7 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
8 target triple = "x86_64-unknown-linux-gnu"
9
10 define {i8*, i1} @foo(i8* %ptr) {
11 %pair = call {i8*, i1} @llvm.type.checked.load(i8* %ptr, i32 16, metadata !"foo")
12 ret {i8*, i1} %pair
13 }
14
15 declare {i8*, i1} @llvm.type.checked.load(i8* %ptr, i32 %offset, metadata %type)