[llvm] r237117 - [mips][FastISel] Allow computation of addresses from constant expressions.
Vasileios Kalintiris
Vasileios.Kalintiris at imgtec.com
Tue May 12 05:08:31 PDT 2015
Author: vkalintiris
Date: Tue May 12 07:08:31 2015
New Revision: 237117
URL: http://llvm.org/viewvc/llvm-project?rev=237117&view=rev
Log:
[mips][FastISel] Allow computation of addresses from constant expressions.
Summary:
Try to compute addresses when the offset from a memory location is a constant
expression.
Based on a patch by Reed Kotler.
Test Plan:
Passes test-suite for -O0/O2 and mips 32 r1/r2
Reviewers: rkotler, dsanders
Subscribers: llvm-commits, aemerson, rfuhler
Differential Revision: http://reviews.llvm.org/D6767
Added:
llvm/trunk/test/CodeGen/Mips/Fast-ISel/constexpr-address.ll
Modified:
llvm/trunk/lib/Target/Mips/MipsFastISel.cpp
Modified: llvm/trunk/lib/Target/Mips/MipsFastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsFastISel.cpp?rev=237117&r1=237116&r2=237117&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsFastISel.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsFastISel.cpp Tue May 12 07:08:31 2015
@@ -390,8 +390,10 @@ bool MipsFastISel::computeAddress(const
Opcode = I->getOpcode();
U = I;
}
- } else if (isa<ConstantExpr>(Obj))
- return false;
+ } else if (const ConstantExpr *C = dyn_cast<ConstantExpr>(Obj)) {
+ Opcode = C->getOpcode();
+ U = C;
+ }
switch (Opcode) {
default:
break;
Added: llvm/trunk/test/CodeGen/Mips/Fast-ISel/constexpr-address.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/Fast-ISel/constexpr-address.ll?rev=237117&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Mips/Fast-ISel/constexpr-address.ll (added)
+++ llvm/trunk/test/CodeGen/Mips/Fast-ISel/constexpr-address.ll Tue May 12 07:08:31 2015
@@ -0,0 +1,18 @@
+; RUN: llc -march=mipsel -mcpu=mips32 -relocation-model=pic \
+; RUN: -fast-isel=true -mips-fast-isel -fast-isel-abort=1 < %s | FileCheck %s
+; RUN: llc -march=mipsel -mcpu=mips32r2 -relocation-model=pic \
+; RUN: -fast-isel=true -mips-fast-isel -fast-isel-abort=1 < %s | FileCheck %s
+
+ at ARR = external global [10 x i32], align 4
+
+define void @foo() {
+; CHECK-LABEL: foo
+
+; CHECK-DAG: lw $[[ARR:[0-9]+]], %got(ARR)({{.*}})
+; CHECK-DAG: addiu $[[T0:[0-9]+]], $zero, 12345
+; CHECK: sw $[[T0]], 8($[[ARR]])
+
+entry:
+ store i32 12345, i32* getelementptr inbounds ([10 x i32], [10 x i32]* @ARR, i32 0, i32 2), align 4
+ ret void
+}
More information about the llvm-commits
mailing list