llvm.org GIT mirror llvm / 9496ac1
Merging r279980: ------------------------------------------------------------------------ r279980 | david.majnemer | 2016-08-29 10:14:08 -0700 (Mon, 29 Aug 2016) | 7 lines [SimplifyCFG] Hoisting invalidates metadata We forgot to remove optimization metadata when performing hosting during FoldTwoEntryPHINode. This fixes PR29163. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_39@288063 91177308-0d34-0410-b5e6-96231b3b80d8 Tom Stellard 2 years ago
2 changed file(s) with 39 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
20232023
20242024 // Move all 'aggressive' instructions, which are defined in the
20252025 // conditional parts of the if's up to the dominating block.
2026 if (IfBlock1)
2026 if (IfBlock1) {
2027 for (auto &I : *IfBlock1)
2028 I.dropUnknownNonDebugMetadata();
20272029 DomBlock->getInstList().splice(InsertPt->getIterator(),
20282030 IfBlock1->getInstList(), IfBlock1->begin(),
20292031 IfBlock1->getTerminator()->getIterator());
2030 if (IfBlock2)
2032 }
2033 if (IfBlock2) {
2034 for (auto &I : *IfBlock2)
2035 I.dropUnknownNonDebugMetadata();
20312036 DomBlock->getInstList().splice(InsertPt->getIterator(),
20322037 IfBlock2->getInstList(), IfBlock2->begin(),
20332038 IfBlock2->getTerminator()->getIterator());
2039 }
20342040
20352041 while (PHINode *PN = dyn_cast(BB->begin())) {
20362042 // Change the PHI node into a select instruction.
0 ; RUN: opt -S -simplifycfg < %s | FileCheck %s
1 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
2 target triple = "x86_64-unknown-linux-gnu"
3
4 @GV = external constant i64*
5
6 define i64* @test1(i1 %cond, i8* %P) {
7 entry:
8 br i1 %cond, label %if, label %then
9
10 then:
11 %bc = bitcast i8* %P to i64*
12 br label %join
13
14 if:
15 %load = load i64*, i64** @GV, align 8, !dereferenceable !0
16 br label %join
17
18 join:
19 %phi = phi i64* [ %bc, %then ], [ %load, %if ]
20 ret i64* %phi
21 }
22
23 ; CHECK-LABEL: define i64* @test1(
24 ; CHECK: %[[bc:.*]] = bitcast i8* %P to i64*
25 ; CHECK: %[[load:.*]] = load i64*, i64** @GV, align 8{{$}}
26 ; CHECK: %[[phi:.*]] = select i1 %cond, i64* %[[load]], i64* %[[bc]]
27 ; CHECK: ret i64* %[[phi]]
28
29
30 !0 = !{i64 8}