https://llvm.org/bugs/show_bug.cgi?id=27615
Bug ID: 27615 Summary: SimplifyCFG::isSafeToSpeculateStore produce different result with debug intrinsic Product: libraries Version: trunk Hardware: All OS: All Status: NEW Severity: normal Priority: P Component: Transformation Utilities Assignee: unassignedb...@nondot.org Reporter: henric.karls...@ericsson.com CC: llvm-bugs@lists.llvm.org Classification: Unclassified Created attachment 16297 --> https://llvm.org/bugs/attachment.cgi?id=16297&action=edit Test case that shows diff in output Depending on if you have @llvm.dbg.value present or not the output from isSafeToSpeculateStore will in some cases be different. Right now the method checks a fixed number of instructions back, but those instructions include the dbg values. One possible fix could be to just ignore dbg values: diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp index 1c27bc6..32b68de 100644 --- a/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/lib/Transforms/Utils/SimplifyCFG.cpp @@ -1449,9 +1449,14 @@ static Value *isSafeToSpeculateStore(Instruction *I, BasicBlock *BrBB, // Look for a store to the same pointer in BrBB. unsigned MaxNumInstToLookAt = 10; for (BasicBlock::reverse_iterator RI = BrBB->rbegin(), - RE = BrBB->rend(); RI != RE && (--MaxNumInstToLookAt); ++RI) { + RE = BrBB->rend(); RI != RE && MaxNumInstToLookAt; ++RI) { Instruction *CurI = &*RI; + // Skip debug info. + if (isa<DbgInfoIntrinsic>(CurI)) + continue; + --MaxNumInstToLookAt; + // Could be calling an instruction that effects memory like free(). if (CurI->mayHaveSideEffects() && !isa<StoreInst>(CurI)) return nullptr; -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs