diff options
| author | Mehdi Amini <mehdi.amini@apple.com> | 2015-12-15 01:44:07 +0000 |
|---|---|---|
| committer | Mehdi Amini <mehdi.amini@apple.com> | 2015-12-15 01:44:07 +0000 |
| commit | 1c131b37ed5f1baf4515938004abf5e7ba72ce47 (patch) | |
| tree | f72c6386ee37e45464bbe14c7e835708efad3a7c /llvm/test/Transforms/InstCombine/extractvalue.ll | |
| parent | fd10d98ed0ed929992e656c96bee8abb7c289d87 (diff) | |
| download | bcm5719-llvm-1c131b37ed5f1baf4515938004abf5e7ba72ce47.tar.gz bcm5719-llvm-1c131b37ed5f1baf4515938004abf5e7ba72ce47.zip | |
Instcombine: destructor loads of structs that do not contains padding
For non padded structs, we can just proceed and deaggregate them.
We don't want ot do this when there is padding in the struct as to not
lose information about this padding (the subsequents passes would then
try hard to preserve the padding, which is undesirable).
Also update extractvalue.ll and cast.ll so that they use structs with padding.
Remove the FIXME in the extractvalue of laod case as the non padded case is
handled when processing the load, and we don't want to do it on the padded
case.
Patch by: Amaury SECHET <deadalnix@gmail.com>
Differential Revision: http://reviews.llvm.org/D14483
From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 255600
Diffstat (limited to 'llvm/test/Transforms/InstCombine/extractvalue.ll')
| -rw-r--r-- | llvm/test/Transforms/InstCombine/extractvalue.ll | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/llvm/test/Transforms/InstCombine/extractvalue.ll b/llvm/test/Transforms/InstCombine/extractvalue.ll index 6319590873a..9c293581a06 100644 --- a/llvm/test/Transforms/InstCombine/extractvalue.ll +++ b/llvm/test/Transforms/InstCombine/extractvalue.ll @@ -48,16 +48,16 @@ define i32 @foo(i32 %a, i32 %b) { ; CHECK: call {{.*}}(i32 [[LOAD]]) ; CHECK-NOT: extractvalue ; CHECK: ret i32 [[LOAD]] -define i32 @extract2gep({i32, i32}* %pair, i32* %P) { +define i32 @extract2gep({i16, i32}* %pair, i32* %P) { ; The load + extractvalue should be converted ; to an inbounds gep + smaller load. ; The new load should be in the same spot as the old load. - %L = load {i32, i32}, {i32, i32}* %pair + %L = load {i16, i32}, {i16, i32}* %pair store i32 0, i32* %P br label %loop loop: - %E = extractvalue {i32, i32} %L, 1 + %E = extractvalue {i16, i32} %L, 1 %C = call i32 @baz(i32 %E) store i32 %C, i32* %P %cond = icmp eq i32 %C, 0 @@ -67,17 +67,17 @@ end: ret i32 %E } -; CHECK-LABEL: define i32 @doubleextract2gep( +; CHECK-LABEL: define i16 @doubleextract2gep( ; CHECK-NEXT: [[GEP:%[a-z0-9]+]] = getelementptr inbounds {{.*}}, {{.*}}* %arg, i64 0, i32 1, i32 1 -; CHECK-NEXT: [[LOAD:%[A-Za-z0-9]+]] = load i32, i32* [[GEP]] -; CHECK-NEXT: ret i32 [[LOAD]] -define i32 @doubleextract2gep({i32, {i32, i32}}* %arg) { +; CHECK-NEXT: [[LOAD:%[A-Za-z0-9]+]] = load i16, i16* [[GEP]] +; CHECK-NEXT: ret i16 [[LOAD]] +define i16 @doubleextract2gep({i16, {i32, i16}}* %arg) { ; The load + extractvalues should be converted ; to a 3-index inbounds gep + smaller load. - %L = load {i32, {i32, i32}}, {i32, {i32, i32}}* %arg - %E1 = extractvalue {i32, {i32, i32}} %L, 1 - %E2 = extractvalue {i32, i32} %E1, 1 - ret i32 %E2 + %L = load {i16, {i32, i16}}, {i16, {i32, i16}}* %arg + %E1 = extractvalue {i16, {i32, i16}} %L, 1 + %E2 = extractvalue {i32, i16} %E1, 1 + ret i16 %E2 } ; CHECK: define i32 @nogep-multiuse |

