diff options
author | Dan Gohman <dan433584@gmail.com> | 2016-01-20 07:03:08 +0000 |
---|---|---|
committer | Dan Gohman <dan433584@gmail.com> | 2016-01-20 07:03:08 +0000 |
commit | edf98c56822a87d93ee601be9f475328c209fecc (patch) | |
tree | 066a3ec17c38c7d76d3742f7ab8bed4cd84702a4 /llvm/test/CodeGen/XCore | |
parent | e5d3c15d7d49d7170f9b2ab79dcea47e79115b68 (diff) | |
download | bcm5719-llvm-edf98c56822a87d93ee601be9f475328c209fecc.tar.gz bcm5719-llvm-edf98c56822a87d93ee601be9f475328c209fecc.zip |
[SelectionDAG] Fold more offsets into GlobalAddresses
SelectionDAG previously missed opportunities to fold constants into
GlobalAddresses in several areas. For example, given `(add (add GA, c1), y)`, it
would often reassociate to `(add (add GA, y), c1)`, missing the opportunity to
create `(add GA+c, y)`. This isn't often visible on targets such as X86 which
effectively reassociate adds in their complex address-mode folding logic,
however it is currently visible on WebAssembly since it currently has very
simple address mode folding code that doesn't reassociate anything.
This patch fixes this by making SelectionDAG fold offsets into GlobalAddresses
at the same times that it folds constants together, so that it doesn't miss any
opportunities to perform such folding.
Differential Revision: http://reviews.llvm.org/D16090
llvm-svn: 258296
Diffstat (limited to 'llvm/test/CodeGen/XCore')
-rw-r--r-- | llvm/test/CodeGen/XCore/threads.ll | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/test/CodeGen/XCore/threads.ll b/llvm/test/CodeGen/XCore/threads.ll index 0c25314295d..30dda143e08 100644 --- a/llvm/test/CodeGen/XCore/threads.ll +++ b/llvm/test/CodeGen/XCore/threads.ll @@ -87,7 +87,7 @@ define i32* @f_tle() { ; CHECK: shl [[R0:r[0-9]]], r11, 3 ; CHECK: ldaw [[R1:r[0-9]]], dp[tle] ; r0 = &tl + id*8 -; CHECK: add r0, [[R1]], [[R0]] +; CHECK: add r0, [[R0]], [[R1]] ret i32* getelementptr inbounds ([2 x i32], [2 x i32]* @tle, i32 0, i32 0) } @@ -96,7 +96,7 @@ define i32 @f_tlExpr () { ; CHECK: get r11, id ; CHECK: shl [[R0:r[0-9]]], r11, 3 ; CHECK: ldaw [[R1:r[0-9]]], dp[tle] -; CHECK: add [[R2:r[0-9]]], [[R1]], [[R0]] +; CHECK: add [[R2:r[0-9]]], [[R0]], [[R1]] ; CHECK: add r0, [[R2]], [[R2]] ret i32 add( i32 ptrtoint( i32* getelementptr inbounds ([2 x i32], [2 x i32]* @tle, i32 0, i32 0) to i32), |