diff options
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/lib/CodeGen/CodeGenPrepare.cpp | 9 | ||||
-rw-r--r-- | llvm/test/Transforms/CodeGenPrepare/X86/select.ll | 4 |
2 files changed, 6 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index 7d7d48b12ce..fd26345b41d 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -426,11 +426,6 @@ bool CodeGenPrepare::runOnFunction(Function &F) { // unconditional branch. EverMadeChange |= eliminateMostlyEmptyBlocks(F); - // llvm.dbg.value is far away from the value then iSel may not be able - // handle it properly. iSel will drop llvm.dbg.value if it can not - // find a node corresponding to the value. - EverMadeChange |= placeDbgValues(F); - if (!DisableBranchOpts) EverMadeChange |= splitBranchCondition(F); @@ -518,6 +513,10 @@ bool CodeGenPrepare::runOnFunction(Function &F) { EverMadeChange |= simplifyOffsetableRelocate(*I); } + // Do this last to clean up use-before-def scenarios introduced by other + // preparatory transforms. + EverMadeChange |= placeDbgValues(F); + return EverMadeChange; } diff --git a/llvm/test/Transforms/CodeGenPrepare/X86/select.ll b/llvm/test/Transforms/CodeGenPrepare/X86/select.ll index 9abb2861595..2c81de9bee8 100644 --- a/llvm/test/Transforms/CodeGenPrepare/X86/select.ll +++ b/llvm/test/Transforms/CodeGenPrepare/X86/select.ll @@ -38,12 +38,12 @@ define float @fdiv_true_sink(float %a, float %b) { ; ; DEBUG-LABEL: @fdiv_true_sink( ; DEBUG-NEXT: entry: -; DEBUG-NEXT: call void @llvm.dbg.value(metadata float [[DIV:%[^,]+]] ; DEBUG-NEXT: [[CMP:%.*]] = fcmp ogt float [[A:%.*]], 1.000000e+00 ; DEBUG-NEXT: call void @llvm.dbg.value(metadata i1 [[CMP]] ; DEBUG-NEXT: br i1 [[CMP]], label [[SELECT_TRUE_SINK:%.*]], label [[SELECT_END:%[^,]+]] ; DEBUG: select.true.sink: -; DEBUG-NEXT: [[DIV]] = fdiv float [[A]], [[B:%.*]] +; DEBUG-NEXT: [[DIV:%.*]] = fdiv float [[A]], [[B:%.*]] +; DEBUG-NEXT: call void @llvm.dbg.value(metadata float [[DIV]] ; DEBUG-NEXT: br label [[SELECT_END]] ; DEBUG: select.end: ; DEBUG-NEXT: [[SEL:%.*]] = phi float [ [[DIV]], [[SELECT_TRUE_SINK]] ], [ 2.000000e+00, [[ENTRY:%.*]] ] |