llvm-6502/lib/Transforms/Scalar
Adrian Prantl a65da70a54 Reapply: Teach SROA how to update debug info for fragmented variables.
This reapplies r225379.

ChangeLog:
- The assertion that this commit previously ran into about the inability
  to handle indirect variables has since been removed and the backend
  can handle this now.
- Testcases were upgrade to the new MDLocation format.
- Instead of keeping a DebugDeclares map, we now use
  llvm::FindAllocaDbgDeclare().

Original commit message follows.

Debug info: Teach SROA how to update debug info for fragmented variables.
This allows us to generate debug info for extremely advanced code such as

 typedef struct { long int a; int b;} S;

 int foo(S s) {
   return s.b;
 }

which at -O1 on x86_64 is codegen'd into

 define i32 @foo(i64 %s.coerce0, i32 %s.coerce1) #0 {
   ret i32 %s.coerce1, !dbg !24
 }

with this patch we emit the following debug info for this

 TAG_formal_parameter [3]
   AT_location( 0x00000000
                0x0000000000000000 - 0x0000000000000006: rdi, piece 0x00000008, rsi, piece 0x00000004
                0x0000000000000006 - 0x0000000000000008: rdi, piece 0x00000008, rax, piece 0x00000004 )
                AT_name( "s" )
                AT_decl_file( "/Volumes/Data/llvm/_build.ninja.release/test.c" )

Thanks to chandlerc, dblaikie, and echristo for their feedback on all
previous iterations of this patch!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226598 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-20 19:42:22 +00:00
..
ADCE.cpp Update SetVector to rely on the underlying set's insert to return a pair<iterator, bool> 2014-11-19 07:49:26 +00:00
AlignmentFromAssumptions.cpp [PM] Split the LoopInfo object apart from the legacy pass, creating 2015-01-17 14:16:18 +00:00
CMakeLists.txt Add a new pass "inductive range check elimination" 2015-01-16 01:03:22 +00:00
ConstantHoisting.cpp Remove unnecessary copying or replace it with moves in a bunch of places. 2014-10-04 16:55:56 +00:00
ConstantProp.cpp [PM] Separate the TargetLibraryInfo object from the immutable pass. 2015-01-15 10:41:28 +00:00
CorrelatedValuePropagation.cpp Make use of @llvm.assume from LazyValueInfo 2014-09-07 20:29:59 +00:00
DCE.cpp [PM] Separate the TargetLibraryInfo object from the immutable pass. 2015-01-15 10:41:28 +00:00
DeadStoreElimination.cpp [PM] Move TargetLibraryInfo into the Analysis library. 2015-01-15 02:16:27 +00:00
EarlyCSE.cpp [PM] Separate the TargetLibraryInfo object from the immutable pass. 2015-01-15 10:41:28 +00:00
FlattenCFGPass.cpp [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE 2014-04-22 02:55:47 +00:00
GVN.cpp [PM] Remove the Pass argument from all of the critical edge splitting 2015-01-19 12:09:11 +00:00
InductiveRangeCheckElimination.cpp [PM] Now that LoopInfo isn't in the Pass type hierarchy, it is much 2015-01-18 01:25:51 +00:00
IndVarSimplify.cpp [PM] Split the LoopInfo object apart from the legacy pass, creating 2015-01-17 14:16:18 +00:00
JumpThreading.cpp [PM] Replace the Pass argument to SplitEdge with specific analyses used 2015-01-19 12:36:53 +00:00
LICM.cpp [PM] Split the LoopInfo object apart from the legacy pass, creating 2015-01-17 14:16:18 +00:00
LLVMBuild.txt Update libdeps since TLI was moved from Target to Analysis in r226078. 2015-01-15 05:21:00 +00:00
LoadCombine.cpp Use AA in LoadCombine 2014-11-03 23:19:16 +00:00
LoopDeletion.cpp [PM] Split the LoopInfo object apart from the legacy pass, creating 2015-01-17 14:16:18 +00:00
LoopIdiomRecognize.cpp [PM] Split the LoopInfo object apart from the legacy pass, creating 2015-01-17 14:16:18 +00:00
LoopInstSimplify.cpp [PM] Split the LoopInfo object apart from the legacy pass, creating 2015-01-17 14:16:18 +00:00
LoopRerollPass.cpp [PM] Split the LoopInfo object apart from the legacy pass, creating 2015-01-17 14:16:18 +00:00
LoopRotation.cpp [PM] Remove the Pass argument from all of the critical edge splitting 2015-01-19 12:09:11 +00:00
LoopStrengthReduce.cpp [PM] Remove the Pass argument from all of the critical edge splitting 2015-01-19 12:09:11 +00:00
LoopUnrollPass.cpp [PM] Split the LoopInfo object apart from the legacy pass, creating 2015-01-17 14:16:18 +00:00
LoopUnswitch.cpp [PM] Replace the Pass argument to SplitEdge with specific analyses used 2015-01-19 12:36:53 +00:00
LowerAtomic.cpp IR: add "cmpxchg weak" variant to support permitted failure. 2014-06-13 14:24:07 +00:00
Makefile
MemCpyOptimizer.cpp [PM] Separate the TargetLibraryInfo object from the immutable pass. 2015-01-15 10:41:28 +00:00
MergedLoadStoreMotion.cpp [PM] Separate the TargetLibraryInfo object from the immutable pass. 2015-01-15 10:41:28 +00:00
PartiallyInlineLibCalls.cpp [PM] Sink the specific analyses preserved by SplitBlock into its 2015-01-18 02:39:37 +00:00
Reassociate.cpp Fix Reassociate handling of constant in presence of undef float 2015-01-16 03:00:58 +00:00
Reg2Mem.cpp Standardize {pred,succ,use,user}_empty() 2015-01-13 03:46:47 +00:00
SampleProfile.cpp [PM] Split the LoopInfo object apart from the legacy pass, creating 2015-01-17 14:16:18 +00:00
Scalar.cpp Add a new pass "inductive range check elimination" 2015-01-16 01:03:22 +00:00
Scalarizer.cpp Revert "IR: MDNode => Value" 2014-11-11 21:30:22 +00:00
ScalarReplAggregates.cpp [PM] Split the AssumptionTracker immutable pass into two separate APIs: 2015-01-04 12:03:27 +00:00
SCCP.cpp [PM] Separate the TargetLibraryInfo object from the immutable pass. 2015-01-15 10:41:28 +00:00
SeparateConstOffsetFromGEP.cpp [SeparateConstOffsetFromGEP] Allow SeparateConstOffsetFromGEP pass to lower GEPs. 2014-11-19 06:24:44 +00:00
SimplifyCFGPass.cpp [PM] Split the AssumptionTracker immutable pass into two separate APIs: 2015-01-04 12:03:27 +00:00
Sink.cpp [PM] Split the LoopInfo object apart from the legacy pass, creating 2015-01-17 14:16:18 +00:00
SROA.cpp Reapply: Teach SROA how to update debug info for fragmented variables. 2015-01-20 19:42:22 +00:00
StructurizeCFG.cpp [PM] Split the LoopInfo object apart from the legacy pass, creating 2015-01-17 14:16:18 +00:00
TailRecursionElimination.cpp Fix tail recursion elimination 2014-11-19 13:32:51 +00:00