[llvm-branch-commits] [llvm-branch] r288063 - Merging r279980:
Tom Stellard via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Nov 28 13:13:04 PST 2016
Author: tstellar
Date: Mon Nov 28 15:13:03 2016
New Revision: 288063
URL: http://llvm.org/viewvc/llvm-project?rev=288063&view=rev
Log:
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.
------------------------------------------------------------------------
Added:
llvm/branches/release_39/test/Transforms/SimplifyCFG/PR29163.ll
Modified:
llvm/branches/release_39/lib/Transforms/Utils/SimplifyCFG.cpp
Modified: llvm/branches/release_39/lib/Transforms/Utils/SimplifyCFG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_39/lib/Transforms/Utils/SimplifyCFG.cpp?rev=288063&r1=288062&r2=288063&view=diff
==============================================================================
--- llvm/branches/release_39/lib/Transforms/Utils/SimplifyCFG.cpp (original)
+++ llvm/branches/release_39/lib/Transforms/Utils/SimplifyCFG.cpp Mon Nov 28 15:13:03 2016
@@ -2024,14 +2024,20 @@ static bool FoldTwoEntryPHINode(PHINode
// Move all 'aggressive' instructions, which are defined in the
// conditional parts of the if's up to the dominating block.
- if (IfBlock1)
+ if (IfBlock1) {
+ for (auto &I : *IfBlock1)
+ I.dropUnknownNonDebugMetadata();
DomBlock->getInstList().splice(InsertPt->getIterator(),
IfBlock1->getInstList(), IfBlock1->begin(),
IfBlock1->getTerminator()->getIterator());
- if (IfBlock2)
+ }
+ if (IfBlock2) {
+ for (auto &I : *IfBlock2)
+ I.dropUnknownNonDebugMetadata();
DomBlock->getInstList().splice(InsertPt->getIterator(),
IfBlock2->getInstList(), IfBlock2->begin(),
IfBlock2->getTerminator()->getIterator());
+ }
while (PHINode *PN = dyn_cast<PHINode>(BB->begin())) {
// Change the PHI node into a select instruction.
Added: llvm/branches/release_39/test/Transforms/SimplifyCFG/PR29163.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_39/test/Transforms/SimplifyCFG/PR29163.ll?rev=288063&view=auto
==============================================================================
--- llvm/branches/release_39/test/Transforms/SimplifyCFG/PR29163.ll (added)
+++ llvm/branches/release_39/test/Transforms/SimplifyCFG/PR29163.ll Mon Nov 28 15:13:03 2016
@@ -0,0 +1,31 @@
+; RUN: opt -S -simplifycfg < %s | FileCheck %s
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+ at GV = external constant i64*
+
+define i64* @test1(i1 %cond, i8* %P) {
+entry:
+ br i1 %cond, label %if, label %then
+
+then:
+ %bc = bitcast i8* %P to i64*
+ br label %join
+
+if:
+ %load = load i64*, i64** @GV, align 8, !dereferenceable !0
+ br label %join
+
+join:
+ %phi = phi i64* [ %bc, %then ], [ %load, %if ]
+ ret i64* %phi
+}
+
+; CHECK-LABEL: define i64* @test1(
+; CHECK: %[[bc:.*]] = bitcast i8* %P to i64*
+; CHECK: %[[load:.*]] = load i64*, i64** @GV, align 8{{$}}
+; CHECK: %[[phi:.*]] = select i1 %cond, i64* %[[load]], i64* %[[bc]]
+; CHECK: ret i64* %[[phi]]
+
+
+!0 = !{i64 8}
More information about the llvm-branch-commits
mailing list