[PATCH] D87685: [Scalarizer] Avoid changing name of non-instructions
Bjorn Pettersson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 15 05:16:56 PDT 2020
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGaa8be5aeead7: [Scalarizer] Avoid changing name of non-instructions (authored by bjope).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D87685/new/
https://reviews.llvm.org/D87685
Files:
llvm/lib/Transforms/Scalar/Scalarizer.cpp
llvm/test/Transforms/Scalarizer/global-bug-2.ll
Index: llvm/test/Transforms/Scalarizer/global-bug-2.ll
===================================================================
--- /dev/null
+++ llvm/test/Transforms/Scalarizer/global-bug-2.ll
@@ -0,0 +1,20 @@
+; RUN: opt < %s -scalarizer -S -o - | FileCheck %s
+; RUN: opt < %s -passes='function(scalarizer)' -S | FileCheck %s
+
+; The scalarizer used to change the name of the global variable
+; Check that the we don't do that any longer.
+;
+; CHECK: @c.a = global i16 0, align 1
+
+ at c.a = global i16 0, align 1
+
+define void @c() {
+entry:
+ br label %for.cond1
+
+for.cond1: ; preds = %for.cond1, %entry
+ %d.sroa.0.0 = phi <4 x i16*> [ <i16* @c.a, i16* @c.a, i16* @c.a, i16* @c.a>, %entry ], [ %d.sroa.0.1.vec.insert, %for.cond1 ]
+ %d.sroa.0.0.vec.extract = extractelement <4 x i16*> %d.sroa.0.0, i32 0
+ %d.sroa.0.1.vec.insert = shufflevector <4 x i16*> <i16* @c.a, i16* null, i16* undef, i16* undef>, <4 x i16*> %d.sroa.0.0, <4 x i32> <i32 0, i32 1, i32 6, i32 7>
+ br label %for.cond1
+}
Index: llvm/lib/Transforms/Scalar/Scalarizer.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/Scalarizer.cpp
+++ llvm/lib/Transforms/Scalar/Scalarizer.cpp
@@ -398,7 +398,8 @@
continue;
Instruction *Old = cast<Instruction>(V);
- CV[I]->takeName(Old);
+ if (isa<Instruction>(CV[I]))
+ CV[I]->takeName(Old);
Old->replaceAllUsesWith(CV[I]);
PotentiallyDeadInstrs.emplace_back(Old);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87685.291868.patch
Type: text/x-patch
Size: 1528 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200915/0ef66011/attachment.bin>
More information about the llvm-commits
mailing list