diff options
author | David Majnemer <david.majnemer@gmail.com> | 2016-07-13 05:16:16 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2016-07-13 05:16:16 +0000 |
commit | 1b3db33e3d67b708c489280b7efeaf33e46a4e05 (patch) | |
tree | 7d413a2a3642c3b50bc54c9868dd445b7e0b8e75 /llvm/test/Transforms/InstCombine/getelementptr.ll | |
parent | c2f791d8a798676067116518ae2b8cfa3c90d638 (diff) | |
download | bcm5719-llvm-1b3db33e3d67b708c489280b7efeaf33e46a4e05.tar.gz bcm5719-llvm-1b3db33e3d67b708c489280b7efeaf33e46a4e05.zip |
[ConstantFolding] Don't treat negative GEP offsets as positive
GEP offsets are signed, don't treat them as huge positive numbers.
llvm-svn: 275251
Diffstat (limited to 'llvm/test/Transforms/InstCombine/getelementptr.ll')
-rw-r--r-- | llvm/test/Transforms/InstCombine/getelementptr.ll | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/llvm/test/Transforms/InstCombine/getelementptr.ll b/llvm/test/Transforms/InstCombine/getelementptr.ll index 276ada91f3c..7446734e210 100644 --- a/llvm/test/Transforms/InstCombine/getelementptr.ll +++ b/llvm/test/Transforms/InstCombine/getelementptr.ll @@ -624,15 +624,11 @@ define i32 @test35() nounwind { ; CHECK: call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @"\01LC8", i64 0, i64 0), i8* getelementptr inbounds (%t0, %t0* @s, i64 0, i32 1, i64 0)) [[NUW:#[0-9]+]] } -; Instcombine should constant-fold the GEP so that indices that have -; static array extents are within bounds of those array extents. -; In the below, -1 is not in the range [0,11). After the transformation, -; the same address is computed, but 3 is in the range of [0,11). - +; Don't treat signed offsets as unsigned. define i8* @test36() nounwind { ret i8* getelementptr ([11 x i8], [11 x i8]* @array, i32 0, i64 -1) ; CHECK-LABEL: @test36( -; CHECK: ret i8* getelementptr ([11 x i8], [11 x i8]* @array, i64 1676976733973595601, i64 4) +; CHECK: ret i8* getelementptr ([11 x i8], [11 x i8]* @array, i64 0, i64 -1) } ; Instcombine shouldn't assume that gep(A,0,1) != gep(A,1,0). |