[llvm] b9a7dea - [SelectionDAG] Handle trapping aggregate (PR49839)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 13 06:07:05 PDT 2022
Author: Nikita Popov
Date: 2022-06-13T15:06:53+02:00
New Revision: b9a7dea9171416a998e4fa3333fb9f76baa167b8
URL: https://github.com/llvm/llvm-project/commit/b9a7dea9171416a998e4fa3333fb9f76baa167b8
DIFF: https://github.com/llvm/llvm-project/commit/b9a7dea9171416a998e4fa3333fb9f76baa167b8.diff
LOG: [SelectionDAG] Handle trapping aggregate (PR49839)
Call canTrap() on Constant to account for trapping
ConstantAggregate.
Added:
Modified:
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
llvm/test/CodeGen/X86/pr49839-trapping-aggregate.ll
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index cd1d63086edc..2b63359c2b1b 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -367,8 +367,8 @@ static void SplitCriticalSideEffectEdges(Function &Fn, DominatorTree *DT,
// PHI.
for (BasicBlock::iterator I = BB.begin(); (PN = dyn_cast<PHINode>(I)); ++I)
for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) {
- ConstantExpr *CE = dyn_cast<ConstantExpr>(PN->getIncomingValue(i));
- if (!CE || !CE->canTrap()) continue;
+ Constant *C = dyn_cast<Constant>(PN->getIncomingValue(i));
+ if (!C || !C->canTrap()) continue;
// The only case we have to worry about is when the edge is critical.
// Since this block has a PHI Node, we assume it has multiple input
diff --git a/llvm/test/CodeGen/X86/pr49839-trapping-aggregate.ll b/llvm/test/CodeGen/X86/pr49839-trapping-aggregate.ll
index 7b606acc9227..e5c23839f038 100644
--- a/llvm/test/CodeGen/X86/pr49839-trapping-aggregate.ll
+++ b/llvm/test/CodeGen/X86/pr49839-trapping-aggregate.ll
@@ -9,12 +9,12 @@ define <1 x i64> @trapping_const_agg(i1 %c, i1 %c2) {
; CHECK-NEXT: testb $1, %dil
; CHECK-NEXT: je .LBB0_4
; CHECK-NEXT: # %bb.1: # %if
+; CHECK-NEXT: testb $1, %sil
+; CHECK-NEXT: je .LBB0_4
+; CHECK-NEXT: # %bb.2: # %if.end_crit_edge
; CHECK-NEXT: movl $1, %eax
; CHECK-NEXT: xorl %edx, %edx
; CHECK-NEXT: idivq g at GOTPCREL(%rip)
-; CHECK-NEXT: testb $1, %sil
-; CHECK-NEXT: je .LBB0_4
-; CHECK-NEXT: # %bb.2:
; CHECK-NEXT: movq %rdx, %rax
; CHECK-NEXT: retq
; CHECK-NEXT: .LBB0_4: # %end2
More information about the llvm-commits
mailing list