[PATCH] D101970: [X86FixupLEAs] Transform the sequence LEA/SUB to SUB/SUB

David Zarzycki via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 25 04:55:49 PDT 2021


davezarzycki added a comment.

I can check it, but I'm a bit concerned about the comment and what it implies. The problem is NOT overflow, but that comparison operations need to be redistributed during this optimization (or dependent comparisons need to disable the optimization). So in pseudocode, the original code that miscompiled looks like this:

if (x - (y + z) <= 0) goto something; // where <= is a unsigned comparison but it really doesn't matter.

So redistributing the arithmetic requires redistributing the comparison.

auto t1 = x - y
if (t1 <= 0) goto something;
if (t1 - z <= 0) goto something;

Does the new patch redistribute comparisons?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101970/new/

https://reviews.llvm.org/D101970



More information about the llvm-commits mailing list