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

Evgeny Astigeevich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 9 12:49:39 PDT 2017


eastig added inline comments.


================
Comment at: lib/Target/ARM/ARMISelLowering.cpp:12400
+  if (Subtarget->isThumb1Only()) {
+    return (AM.Scale == 1);
+  }
----------------
efriedma wrote:
> 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.
What a pass creates this situation: "AM.Scale == 2" and "HasBaseReg == false"? How to write an IR test for it?


https://reviews.llvm.org/D36467





More information about the llvm-commits mailing list