From 2428a4050f066a51ff9dbd713aab0356ca435e7d Mon Sep 17 00:00:00 2001 From: Robert Lougher Date: Wed, 14 Dec 2016 17:49:19 +0000 Subject: [InstCombine] Merge debug locations when folding through a phi node If all the operands to a phi node are of the same operation, instcombine will try to pull them through the phi node, combining them into a single operation. When it does this, the debug location of the operation should be the merged debug locations of the phi node arguments. Patch 2 of 8 for D26256. Folding of a binary operation. Differential Revision: https://reviews.llvm.org/D26256 llvm-svn: 289679 --- llvm/lib/Transforms/InstCombine/InstCombineInternal.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'llvm/lib/Transforms/InstCombine/InstCombineInternal.h') diff --git a/llvm/lib/Transforms/InstCombine/InstCombineInternal.h b/llvm/lib/Transforms/InstCombine/InstCombineInternal.h index e6b9bca1289..d13b94cb6c9 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineInternal.h +++ b/llvm/lib/Transforms/InstCombine/InstCombineInternal.h @@ -553,6 +553,10 @@ private: Instruction *FoldPHIArgLoadIntoPHI(PHINode &PN); Instruction *FoldPHIArgZextsIntoPHI(PHINode &PN); + /// Helper function for FoldPHIArgXIntoPHI() to get debug location for the + /// folded operation. + DebugLoc PHIArgMergedDebugLoc(PHINode &PN); + Instruction *foldGEPICmp(GEPOperator *GEPLHS, Value *RHS, ICmpInst::Predicate Cond, Instruction &I); Instruction *foldAllocaCmp(ICmpInst &ICI, const AllocaInst *Alloca, -- cgit v1.2.3