[PATCH] D55729: [CodeGenPrepare] Fix bad IR created by large offset GEP splitting.
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 19 14:55:20 PST 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL349693: [CodeGenPrepare] Fix bad IR created by large offset GEP splitting. (authored by efriedma, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D55729?vs=178320&id=178970#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D55729/new/
https://reviews.llvm.org/D55729
Files:
llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp
llvm/trunk/test/Transforms/CodeGenPrepare/AArch64/large-offset-gep.ll
Index: llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp
+++ llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp
@@ -5160,11 +5160,11 @@
}
// Generate a new GEP to replace the current one.
- IRBuilder<> Builder(GEP);
+ LLVMContext &Ctx = GEP->getContext();
Type *IntPtrTy = DL->getIntPtrType(GEP->getType());
Type *I8PtrTy =
- Builder.getInt8PtrTy(GEP->getType()->getPointerAddressSpace());
- Type *I8Ty = Builder.getInt8Ty();
+ Type::getInt8PtrTy(Ctx, GEP->getType()->getPointerAddressSpace());
+ Type *I8Ty = Type::getInt8Ty(Ctx);
if (!NewBaseGEP) {
// Create a new base if we don't have one yet. Find the insertion
@@ -5200,6 +5200,7 @@
NewGEPBases.insert(NewBaseGEP);
}
+ IRBuilder<> Builder(GEP);
Value *NewGEP = NewBaseGEP;
if (Offset == BaseOffset) {
if (GEP->getType() != I8PtrTy)
Index: llvm/trunk/test/Transforms/CodeGenPrepare/AArch64/large-offset-gep.ll
===================================================================
--- llvm/trunk/test/Transforms/CodeGenPrepare/AArch64/large-offset-gep.ll
+++ llvm/trunk/test/Transforms/CodeGenPrepare/AArch64/large-offset-gep.ll
@@ -88,18 +88,23 @@
}
declare %struct_type* @foo()
+declare void @foo2()
define void @test4(i32 %n) personality i32 (...)* @__FrameHandler {
; CHECK-LABEL: test4
entry:
- %struct = invoke %struct_type* @foo() to label %while_cond unwind label %cleanup
+ br label %while_cond
while_cond:
%phi = phi i32 [ 0, %entry ], [ %i, %while_body ]
+ %struct = invoke %struct_type* @foo() to label %while_cond_x unwind label %cleanup
+
+while_cond_x:
; CHECK: mov w{{[0-9]+}}, #40000
; CHECK-NOT: mov w{{[0-9]+}}, #40004
%gep0 = getelementptr %struct_type, %struct_type* %struct, i64 0, i32 1
%gep1 = getelementptr %struct_type, %struct_type* %struct, i64 0, i32 2
+ store i32 0, i32* %gep0
%cmp = icmp slt i32 %phi, %n
br i1 %cmp, label %while_body, label %while_end
@@ -114,8 +119,10 @@
ret void
cleanup:
- landingpad { i8*, i32 } cleanup
- unreachable
+ %x10 = landingpad { i8*, i32 }
+ cleanup
+ call void @foo2()
+ resume { i8*, i32 } %x10
}
declare i32 @__FrameHandler(...)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55729.178970.patch
Type: text/x-patch
Size: 2350 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181219/abe90aec/attachment.bin>
More information about the llvm-commits
mailing list