[llvm] r345082 - CGP: Clear data structures at the end of a loop iteration instead of the beginning.
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 23 14:23:18 PDT 2018
Author: pcc
Date: Tue Oct 23 14:23:18 2018
New Revision: 345082
URL: http://llvm.org/viewvc/llvm-project?rev=345082&view=rev
Log:
CGP: Clear data structures at the end of a loop iteration instead of the beginning.
Clearing LargeOffsetGEPMap at the end fixes a bug where if a large
offset GEP is in a dead basic block, we fail an assertion when trying
to delete the block due to the asserting VH in LargeOffsetGEPMap.
Differential Revision: https://reviews.llvm.org/D53464
Added:
llvm/trunk/test/CodeGen/Thumb2/unreachable-large-offset-gep.ll
Modified:
llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp
Modified: llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp?rev=345082&r1=345081&r2=345082&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp (original)
+++ llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp Tue Oct 23 14:23:18 2018
@@ -436,11 +436,6 @@ bool CodeGenPrepare::runOnFunction(Funct
bool MadeChange = true;
while (MadeChange) {
MadeChange = false;
- SeenChainsForSExt.clear();
- ValToSExtendedUses.clear();
- RemovedInsts.clear();
- LargeOffsetGEPMap.clear();
- LargeOffsetGEPID.clear();
for (Function::iterator I = F.begin(); I != F.end(); ) {
BasicBlock *BB = &*I++;
bool ModifiedDTOnIteration = false;
@@ -460,6 +455,11 @@ bool CodeGenPrepare::runOnFunction(Funct
I->deleteValue();
EverMadeChange |= MadeChange;
+ SeenChainsForSExt.clear();
+ ValToSExtendedUses.clear();
+ RemovedInsts.clear();
+ LargeOffsetGEPMap.clear();
+ LargeOffsetGEPID.clear();
}
SunkAddrs.clear();
Added: llvm/trunk/test/CodeGen/Thumb2/unreachable-large-offset-gep.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/unreachable-large-offset-gep.ll?rev=345082&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Thumb2/unreachable-large-offset-gep.ll (added)
+++ llvm/trunk/test/CodeGen/Thumb2/unreachable-large-offset-gep.ll Tue Oct 23 14:23:18 2018
@@ -0,0 +1,22 @@
+; RUN: llc -o - %s | FileCheck %s
+
+; CHECK: .LBB0_1:
+; CHECK: b .LBB0_1
+
+target triple = "thumbv8m-unknown-linux-android"
+
+define void @d(i32* %c) {
+entry:
+ br i1 false, label %f.exit, label %i.d
+
+i.d:
+ br label %i.d
+
+f.exit:
+ %0 = getelementptr i32, i32* %c, i32 57
+ br label %if.g
+
+if.g:
+ store i32 0, i32* %0
+ ret void
+}
More information about the llvm-commits
mailing list