[llvm] 4a7a988 - [Attributor][FIX] Move assertion to make it not trivially fail
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 6 07:33:05 PDT 2020
Author: Johannes Doerfert
Date: 2020-10-06T09:32:18-05:00
New Revision: 4a7a988442dfa40309b34746218c07ebf758b378
URL: https://github.com/llvm/llvm-project/commit/4a7a988442dfa40309b34746218c07ebf758b378
DIFF: https://github.com/llvm/llvm-project/commit/4a7a988442dfa40309b34746218c07ebf758b378.diff
LOG: [Attributor][FIX] Move assertion to make it not trivially fail
The idea of this assertion was to check the simplified value before we
assign it, not after, which caused this to trivially fail all the time.
Added:
Modified:
llvm/lib/Transforms/IPO/AttributorAttributes.cpp
llvm/test/Transforms/Attributor/value-simplify.ll
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index 6e31625f9daa..3f85d968f8e3 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -4774,10 +4774,10 @@ struct AAValueSimplifyFloating : AAValueSimplifyImpl {
if (Op0IsNull && Op1IsNull) {
Value *NewVal = ConstantInt::get(
Type::getInt1Ty(Ctx), ICmp->getPredicate() == CmpInst::ICMP_EQ);
- SimplifiedAssociatedValue = NewVal;
- indicateOptimisticFixpoint();
assert(!SimplifiedAssociatedValue.hasValue() &&
"Did not expect non-fixed value for constant comparison");
+ SimplifiedAssociatedValue = NewVal;
+ indicateOptimisticFixpoint();
Changed = ChangeStatus::CHANGED;
return true;
}
diff --git a/llvm/test/Transforms/Attributor/value-simplify.ll b/llvm/test/Transforms/Attributor/value-simplify.ll
index 174fd799a6e0..8fc34cd08ed6 100644
--- a/llvm/test/Transforms/Attributor/value-simplify.ll
+++ b/llvm/test/Transforms/Attributor/value-simplify.ll
@@ -788,3 +788,18 @@ define internal i8 @callee(i8 %a) {
ret i8 %c
}
+
+define i1 @icmp() {
+; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
+; IS__TUNIT____-LABEL: define {{[^@]+}}@icmp
+; IS__TUNIT____-SAME: () [[ATTR1]] {
+; IS__TUNIT____-NEXT: ret i1 true
+;
+; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
+; IS__CGSCC____-LABEL: define {{[^@]+}}@icmp
+; IS__CGSCC____-SAME: () [[ATTR1]] {
+; IS__CGSCC____-NEXT: ret i1 true
+;
+ %c = icmp eq i8* null, null
+ ret i1 %c
+}
More information about the llvm-commits
mailing list