[PATCH] D36467: [ARM, FIX] ARMTargetLowering::isLegalAddressingMode can accept illegal addressing modes for Thumb1 target

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 9 12:26:44 PDT 2017


efriedma added inline comments.


================
Comment at: lib/Target/ARM/ARMISelLowering.cpp:12400
+  if (Subtarget->isThumb1Only()) {
+    return (AM.Scale == 1);
+  }
----------------
eastig wrote:
> efriedma wrote:
> > Maybe `((unsigned)AM.HasBaseReg + Scale) <= 2`, like we use in other places?  It doesn't come up often, but it's easy to support.
> This will accept negative scales: (unsigned)true + (unsigned)-1 == 0
> Thumb1 addressing modes do not support negative scales. I'll put this in the comment.
Oh, err, wow, that's a really nasty use of wrapping arithmetic.  I'll propose a patch to clarify it.

We should still be able to support the case where "AM.Scale == 2" and "HasBaseReg" is false for Thumb1.


https://reviews.llvm.org/D36467





More information about the llvm-commits mailing list