[llvm] ea602cb - [IR] Support or disjoint in hasPoisonGeneratingFlags()
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 30 08:26:34 PST 2023
Author: Nikita Popov
Date: 2023-11-30T17:26:23+01:00
New Revision: ea602cb80678fbf5f52bbbda142437164b2a3407
URL: https://github.com/llvm/llvm-project/commit/ea602cb80678fbf5f52bbbda142437164b2a3407
DIFF: https://github.com/llvm/llvm-project/commit/ea602cb80678fbf5f52bbbda142437164b2a3407.diff
LOG: [IR] Support or disjoint in hasPoisonGeneratingFlags()
This fixed incorrect removal of freeze instructions.
Added:
Modified:
llvm/lib/IR/Operator.cpp
llvm/test/Transforms/InstSimplify/freeze-noundef.ll
Removed:
################################################################################
diff --git a/llvm/lib/IR/Operator.cpp b/llvm/lib/IR/Operator.cpp
index 0c917ad77e15806..017641a8dba19d4 100644
--- a/llvm/lib/IR/Operator.cpp
+++ b/llvm/lib/IR/Operator.cpp
@@ -32,6 +32,8 @@ bool Operator::hasPoisonGeneratingFlags() const {
case Instruction::AShr:
case Instruction::LShr:
return cast<PossiblyExactOperator>(this)->isExact();
+ case Instruction::Or:
+ return cast<PossiblyDisjointInst>(this)->isDisjoint();
case Instruction::GetElementPtr: {
auto *GEP = cast<GEPOperator>(this);
// Note: inrange exists on constexpr only
diff --git a/llvm/test/Transforms/InstSimplify/freeze-noundef.ll b/llvm/test/Transforms/InstSimplify/freeze-noundef.ll
index 255a1921c1ed204..e6c296994cf6a35 100644
--- a/llvm/test/Transforms/InstSimplify/freeze-noundef.ll
+++ b/llvm/test/Transforms/InstSimplify/freeze-noundef.ll
@@ -29,11 +29,11 @@ define i1 @or(i1 noundef %x, i1 noundef %x2) {
ret i1 %z
}
-; FIXME: This is a miscompile.
define i1 @or_disjoint(i1 noundef %x, i1 noundef %x2) {
; CHECK-LABEL: @or_disjoint(
; CHECK-NEXT: [[Y:%.*]] = or disjoint i1 [[X:%.*]], [[X2:%.*]]
-; CHECK-NEXT: ret i1 [[Y]]
+; CHECK-NEXT: [[Z:%.*]] = freeze i1 [[Y]]
+; CHECK-NEXT: ret i1 [[Z]]
;
%y = or disjoint i1 %x, %x2
%z = freeze i1 %y
More information about the llvm-commits
mailing list