[PATCH] D48327: [IPSCC] Drop ParamState lattice value when marking a value as force constant.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 19 09:53:57 PDT 2018
fhahn created this revision.
fhahn added reviewers: davide, efriedma.
ParamState lattice elements do not have support for forced constants,
so we have to drop any more precise information.
Fixes PR35723.
https://reviews.llvm.org/D48327
Files:
lib/Transforms/Scalar/SCCP.cpp
test/Transforms/SCCP/ipsccp-paramstate-forcedconst.ll
Index: test/Transforms/SCCP/ipsccp-paramstate-forcedconst.ll
===================================================================
--- /dev/null
+++ test/Transforms/SCCP/ipsccp-paramstate-forcedconst.ll
@@ -0,0 +1,24 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt < %s -S -ipsccp | FileCheck %s
+
+define void @main() {
+; CHECK-LABEL: @main(
+; CHECK-NEXT: [[CALL:%.*]] = call i1 @patatino(i1 undef)
+; CHECK-NEXT: ret void
+;
+ %call = call i1 @patatino(i1 undef)
+ ret void
+}
+
+define internal i1 @patatino(i1 %a) {
+; CHECK-LABEL: @patatino(
+; CHECK-NEXT: br label [[ONFALSE:%.*]]
+; CHECK: onfalse:
+; CHECK-NEXT: ret i1 undef
+;
+ br i1 %a, label %ontrue, label %onfalse
+ontrue:
+ ret i1 false
+onfalse:
+ ret i1 false
+}
Index: lib/Transforms/Scalar/SCCP.cpp
===================================================================
--- lib/Transforms/Scalar/SCCP.cpp
+++ lib/Transforms/Scalar/SCCP.cpp
@@ -428,6 +428,9 @@
assert(!V->getType()->isStructTy() && "structs should use mergeInValue");
LatticeVal &IV = ValueState[V];
IV.markForcedConstant(C);
+ // ParamState lattice elements do not have support for forced constants,
+ // so we have to drop any more precise information.
+ ParamState.erase(V);
LLVM_DEBUG(dbgs() << "markForcedConstant: " << *C << ": " << *V << '\n');
pushToWorkList(IV, V);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48327.151935.patch
Type: text/x-patch
Size: 1412 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180619/a012b963/attachment.bin>
More information about the llvm-commits
mailing list