[llvm-commits] [llvm] r88806 - /llvm/trunk/lib/CodeGen/MachineFunction.cpp
Jim Grosbach
grosbach at apple.com
Sat Nov 14 14:27:25 PST 2009
On Nov 14, 2009, at 2:14 PM, Evan Cheng wrote:
> Jim, I'd prefer to disable the sharing only when it's known to be
> unsafe. Is that possible?
>
I don't see a straightforward way to identify when it's appropriate
and when it's not at this point. The more I look at it, the more I
feel doing the merging here is pre-mature, and if it's useful, it
should be done significantly later in the compilation, after any
optimizations that may manipulate the tables in other ways have run.
If we're sharing tables, when we're manipulating the destinations of
one jump table branch, we're also potentially changing the destination
blocks for other branches which use the same table. That'll cause the
CFG to be incorrect for those branches, and things go very badly from
there.
That said, if anyone has suggestions for alternative approaches that
clean up the above problem while still allowing us to share the tables
this early, that'd be great.
-Jim
> On Nov 14, 2009, at 12:15 PM, Jim Grosbach <grosbach at apple.com> wrote:
>
>> Author: grosbach
>> Date: Sat Nov 14 14:15:03 2009
>> New Revision: 88806
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=88806&view=rev
>> Log:
>> Do not merge jump tables this early. Branch folding will do any
>> necessary
>> merges, and until then, it's useful to keep the tables separate for
>> ease
>> of manipulation.
>>
>> Modified:
>> llvm/trunk/lib/CodeGen/MachineFunction.cpp
>>
>> Modified: llvm/trunk/lib/CodeGen/MachineFunction.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunction.cpp?rev=88806&r1=88805&r2=88806&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- llvm/trunk/lib/CodeGen/MachineFunction.cpp (original)
>> +++ llvm/trunk/lib/CodeGen/MachineFunction.cpp Sat Nov 14 14:15:03
>> 2009
>> @@ -530,10 +530,6 @@
>> unsigned MachineJumpTableInfo::getJumpTableIndex(
>> const std::vector<MachineBasicBlock*>
>> &DestBBs) {
>> assert(!DestBBs.empty() && "Cannot create an empty jump table!");
>> - for (unsigned i = 0, e = JumpTables.size(); i != e; ++i)
>> - if (JumpTables[i].MBBs == DestBBs)
>> - return i;
>> -
>> JumpTables.push_back(MachineJumpTableEntry(DestBBs));
>> return JumpTables.size()-1;
>> }
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list