[PATCH] [NoTTI] reject negative scale in addressing mode

Jingyue Wu jingyue at google.com
Wed May 6 11:27:57 PDT 2015


Hi atrick,

I noticed this bug when deubging a WIP on LSR. I wonder whether and how we
should add a regression test for this.

http://reviews.llvm.org/D9536

Files:
  include/llvm/Analysis/TargetTransformInfoImpl.h

Index: include/llvm/Analysis/TargetTransformInfoImpl.h
===================================================================
--- include/llvm/Analysis/TargetTransformInfoImpl.h
+++ include/llvm/Analysis/TargetTransformInfoImpl.h
@@ -210,7 +210,7 @@
                              bool HasBaseReg, int64_t Scale) {
     // Guess that reg+reg addressing is allowed. This heuristic is taken from
     // the implementation of LSR.
-    return !BaseGV && BaseOffset == 0 && Scale <= 1;
+    return !BaseGV && BaseOffset == 0 && (Scale == 0 || Scale == 1);
   }
 
   bool isLegalMaskedStore(Type *DataType, int Consecutive) { return false; }

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9536.25073.patch
Type: text/x-patch
Size: 634 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150506/bc3e368c/attachment.bin>


More information about the llvm-commits mailing list