Page MenuHomePhabricator

[StackColoring] When remapping alloca's move the To alloca if the From alloca is before it.
ClosedPublic

Authored by craig.topper on Sun, May 17, 10:31 PM.

Details

Summary

If To is after From its possible that there's a use of From
between them.

I'm not sure if this is the right fix, but wanted to start here
for discussion. Also not sure how to test this since we're in
the Machine IR section of the pipeline, but modifying IR.

Fixes issue reported here http://lists.llvm.org/pipermail/llvm-dev/2020-May/141421.html

Diff Detail

Event Timeline

craig.topper created this revision.Sun, May 17, 10:31 PM
Herald added a project: Restricted Project. · View Herald TranscriptSun, May 17, 10:31 PM
Herald added a subscriber: hiraditya. · View Herald Transcript

Did we have a bug with reproducer that we can run? I hope there is also a way to run only this pass and get the output (IR). Though, I don't know how :)


I find the patch fine but I want someone else to say something as well.
Nit: maybe put the first sentence of the commit message as a comment before the conditional.

Did we have a bug with reproducer that we can run? I hope there is also a way to run only this pass and get the output (IR). Though, I don't know how :)


I find the patch fine but I want someone else to say something as well.
Nit: maybe put the first sentence of the commit message as a comment before the conditional.

We have this C++ test which we can get IR for llc from.

class d {
  float b[4];
};

d operator-(d);
struct e {
  struct f {
    int *c[4];
  };
  void h(const d &);
};

struct j {
  int temp;
  e::f k();
};
d i;

void g() {
  e a;
  a.h(-i);
  j b;
  b.k();
}

Also not sure how to test this since we're in the Machine IR section of the pipeline, but modifying IR.

If you run a pass with llc -run-pass, it prints both the LLVM IR module, and the MIR for each function after the pass runs.

This revision is now accepted and ready to land.Mon, May 18, 9:44 PM
This revision was automatically updated to reflect the committed changes.