[PATCH] fix for PR16393: miscompile with struct byval

Jakob Stoklund Olesen jolesen at apple.com
Thu Jul 11 16:37:57 PDT 2013


On Jul 11, 2013, at 12:07 PM, Manman Ren <mren at apple.com> wrote:

> <byval_spadj_verify.patch>

Thanks, Manman

I still think the logic would be simpler if you write the loop like this:

for (...) {
  if (I->getOpcode() == FrameSetupOpcode) {
    ...
  } 
  if (I->getOpcode() == FrameDestroyOpcode) {
    ...
  }
}

Also:

+    int SPAdj = 0;
+    bool IsSetup = false;
+    int SPAdjAfter = SPAdj;
+    bool IsSetupAfter = IsSetup;

Should this just be an instance of the struct you just defined?

+      if (I->getOpcode() == FrameSetupOpcode)
+        Size = -Size;
+      SPAdjAfter += Size;

Why the math? If these things don’t nest, it should never be necessary to add or subtract stack adjustments.

With those changes, the verifier patch looks good to me.

Thanks,
/jakob





More information about the llvm-commits mailing list