Skip to content

Commit cf1cf5f

Browse files
authored
Merge branch 'main' into fixme-dag-not-sub-generalize
2 parents 4a208c9 + 40edc34 commit cf1cf5f

File tree

47 files changed

+817
-607
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+817
-607
lines changed

clang/docs/OpenMPSupport.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,10 @@ implementation.
477477
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
478478
| Local clause on declare target | :part:`In Progress` | :none:`unclaimed` | |
479479
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
480-
| groupprivate directive | :part:`In Progress` | :part:`In Progress` | Flang: kparzysz, mjklemm |
480+
| groupprivate directive | :part:`In Progress` | :part:`partial` | Flang: kparzysz, mjklemm |
481+
| | | | |
482+
| | | | Flang parser: https://github.com/llvm/llvm-project/pull/153807 |
483+
| | | | Flang sema: https://github.com/llvm/llvm-project/pull/154779 |
481484
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
482485
| variable-category on default clause | :part:`In Progress` | :none:`unclaimed` | |
483486
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+

clang/lib/AST/ByteCode/InterpState.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ InterpState::InterpState(State &Parent, Program &P, InterpStack &Stk,
2121
Context &Ctx, SourceMapper *M)
2222
: Parent(Parent), M(M), P(P), Stk(Stk), Ctx(Ctx), BottomFrame(*this),
2323
Current(&BottomFrame) {
24+
InConstantContext = Parent.InConstantContext;
2425
CheckingPotentialConstantExpression =
2526
Parent.CheckingPotentialConstantExpression;
2627
CheckingForUndefinedBehavior = Parent.CheckingForUndefinedBehavior;
@@ -31,6 +32,7 @@ InterpState::InterpState(State &Parent, Program &P, InterpStack &Stk,
3132
: Parent(Parent), M(nullptr), P(P), Stk(Stk), Ctx(Ctx),
3233
BottomFrame(*this, Func, nullptr, CodePtr(), Func->getArgSize()),
3334
Current(&BottomFrame) {
35+
InConstantContext = Parent.InConstantContext;
3436
CheckingPotentialConstantExpression =
3537
Parent.CheckingPotentialConstantExpression;
3638
CheckingForUndefinedBehavior = Parent.CheckingForUndefinedBehavior;
@@ -40,7 +42,7 @@ bool InterpState::inConstantContext() const {
4042
if (ConstantContextOverride)
4143
return *ConstantContextOverride;
4244

43-
return Parent.InConstantContext;
45+
return InConstantContext;
4446
}
4547

4648
InterpState::~InterpState() {

clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,8 +1355,7 @@ mlir::LogicalResult CIRToLLVMConstantOpLowering::matchAndRewrite(
13551355
} else {
13561356
const mlir::Value initVal =
13571357
lowerCirAttrAsValue(op, op.getValue(), rewriter, typeConverter);
1358-
rewriter.replaceAllUsesWith(op, initVal);
1359-
rewriter.eraseOp(op);
1358+
rewriter.replaceOp(op, initVal);
13601359
return mlir::success();
13611360
}
13621361
} else if (const auto recordAttr =
@@ -2653,8 +2652,7 @@ mlir::LogicalResult CIRToLLVMVTableGetVPtrOpLowering::matchAndRewrite(
26532652
// pointer to the vptr type. Since the LLVM dialect uses opaque pointers
26542653
// we can just replace uses of this operation with the original pointer.
26552654
mlir::Value srcVal = adaptor.getSrc();
2656-
rewriter.replaceAllUsesWith(op, srcVal);
2657-
rewriter.eraseOp(op);
2655+
rewriter.replaceOp(op, srcVal);
26582656
return mlir::success();
26592657
}
26602658

lldb/test/API/tools/lldb-dap/step/TestDAP_step.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ def test_step(self):
8484
# only step one thread that is at the breakpoint and stop
8585
break
8686

87+
@skipIfWindows
8788
def test_step_over_inlined_function(self):
8889
"""
8990
Test stepping over when the program counter is in another file.

llvm/include/llvm/Analysis/ConstantFolding.h

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,27 @@ LLVM_ABI bool isMathLibCallNoop(const CallBase *Call,
226226

227227
LLVM_ABI Constant *ReadByteArrayFromGlobal(const GlobalVariable *GV,
228228
uint64_t Offset);
229-
}
229+
230+
struct PreservedCastFlags {
231+
bool NNeg = false;
232+
bool NUW = false;
233+
bool NSW = false;
234+
};
235+
236+
/// Try to cast C to InvC losslessly, satisfying CastOp(InvC) equals C, or
237+
/// CastOp(InvC) is a refined value of undefined C. Will try best to
238+
/// preserve the flags.
239+
LLVM_ABI Constant *getLosslessInvCast(Constant *C, Type *InvCastTo,
240+
unsigned CastOp, const DataLayout &DL,
241+
PreservedCastFlags *Flags = nullptr);
242+
243+
LLVM_ABI Constant *
244+
getLosslessUnsignedTrunc(Constant *C, Type *DestTy, const DataLayout &DL,
245+
PreservedCastFlags *Flags = nullptr);
246+
247+
LLVM_ABI Constant *getLosslessSignedTrunc(Constant *C, Type *DestTy,
248+
const DataLayout &DL,
249+
PreservedCastFlags *Flags = nullptr);
250+
} // namespace llvm
230251

231252
#endif

llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -433,10 +433,6 @@ class SCEVExpander : public SCEVVisitor<SCEVExpander, Value *> {
433433
LLVM_ABI BasicBlock::iterator
434434
findInsertPointAfter(Instruction *I, Instruction *MustDominate) const;
435435

436-
/// Remove inserted instructions that are dead, e.g. due to InstSimplifyFolder
437-
/// simplifications. \p Root is assumed to be used and won't be removed.
438-
void eraseDeadInstructions(Value *Root);
439-
440436
private:
441437
LLVMContext &getContext() const { return SE.getContext(); }
442438

llvm/lib/Analysis/ConstantFolding.cpp

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4608,4 +4608,55 @@ bool llvm::isMathLibCallNoop(const CallBase *Call,
46084608
return false;
46094609
}
46104610

4611+
Constant *llvm::getLosslessInvCast(Constant *C, Type *InvCastTo,
4612+
unsigned CastOp, const DataLayout &DL,
4613+
PreservedCastFlags *Flags) {
4614+
switch (CastOp) {
4615+
case Instruction::BitCast:
4616+
// Bitcast is always lossless.
4617+
return ConstantFoldCastOperand(Instruction::BitCast, C, InvCastTo, DL);
4618+
case Instruction::Trunc: {
4619+
auto *ZExtC = ConstantFoldCastOperand(Instruction::ZExt, C, InvCastTo, DL);
4620+
if (Flags) {
4621+
// Truncation back on ZExt value is always NUW.
4622+
Flags->NUW = true;
4623+
// Test positivity of C.
4624+
auto *SExtC =
4625+
ConstantFoldCastOperand(Instruction::SExt, C, InvCastTo, DL);
4626+
Flags->NSW = ZExtC == SExtC;
4627+
}
4628+
return ZExtC;
4629+
}
4630+
case Instruction::SExt:
4631+
case Instruction::ZExt: {
4632+
auto *InvC = ConstantExpr::getTrunc(C, InvCastTo);
4633+
auto *CastInvC = ConstantFoldCastOperand(CastOp, InvC, C->getType(), DL);
4634+
// Must satisfy CastOp(InvC) == C.
4635+
if (!CastInvC || CastInvC != C)
4636+
return nullptr;
4637+
if (Flags && CastOp == Instruction::ZExt) {
4638+
auto *SExtInvC =
4639+
ConstantFoldCastOperand(Instruction::SExt, InvC, C->getType(), DL);
4640+
// Test positivity of InvC.
4641+
Flags->NNeg = CastInvC == SExtInvC;
4642+
}
4643+
return InvC;
4644+
}
4645+
default:
4646+
return nullptr;
4647+
}
4648+
}
4649+
4650+
Constant *llvm::getLosslessUnsignedTrunc(Constant *C, Type *DestTy,
4651+
const DataLayout &DL,
4652+
PreservedCastFlags *Flags) {
4653+
return getLosslessInvCast(C, DestTy, Instruction::ZExt, DL, Flags);
4654+
}
4655+
4656+
Constant *llvm::getLosslessSignedTrunc(Constant *C, Type *DestTy,
4657+
const DataLayout &DL,
4658+
PreservedCastFlags *Flags) {
4659+
return getLosslessInvCast(C, DestTy, Instruction::SExt, DL, Flags);
4660+
}
4661+
46114662
void TargetFolder::anchor() {}

llvm/lib/Linker/IRMover.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1152,7 +1152,6 @@ void IRLinker::linkNamedMDNodes() {
11521152
if (Inserted.insert(MD).second)
11531153
DestNMD->addOperand(MD);
11541154
}
1155-
assert(Inserted.size() == DestNMD->getNumOperands());
11561155
}
11571156
}
11581157

llvm/lib/Target/AArch64/AArch64InstrInfo.td

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8323,6 +8323,29 @@ def MVNIv4s_msl : SIMDModifiedImmMoveMSL<1, 1, {1,1,0,?}, V128, "mvni", ".4s",
83238323
(AArch64mvni_msl imm0_255:$imm8, (i32 imm:$shift)))]>;
83248324
}
83258325

8326+
// SABA patterns for add(x, abs(y)) -> saba(x, y, 0)
8327+
def : Pat<(v8i8 (add V64:$Vn, (abs V64:$Vm))),
8328+
(SABAv8i8 V64:$Vn, V64:$Vm, (EXTRACT_SUBREG (MOVIv2d_ns (i32 0)), dsub))>;
8329+
def : Pat<(v4i16 (add V64:$Vn, (abs V64:$Vm))),
8330+
(SABAv4i16 V64:$Vn, V64:$Vm, (EXTRACT_SUBREG (MOVIv2d_ns (i32 0)), dsub))>;
8331+
def : Pat<(v2i32 (add V64:$Vn, (abs V64:$Vm))),
8332+
(SABAv2i32 V64:$Vn, V64:$Vm, (EXTRACT_SUBREG (MOVIv2d_ns (i32 0)), dsub))>;
8333+
def : Pat<(v16i8 (add V128:$Vn, (abs V128:$Vm))),
8334+
(SABAv16i8 V128:$Vn, V128:$Vm, (MOVIv2d_ns (i32 0)))>;
8335+
def : Pat<(v8i16 (add V128:$Vn, (abs V128:$Vm))),
8336+
(SABAv8i16 V128:$Vn, V128:$Vm, (MOVIv2d_ns (i32 0)))>;
8337+
def : Pat<(v4i32 (add V128:$Vn, (abs V128:$Vm))),
8338+
(SABAv4i32 V128:$Vn, V128:$Vm, (MOVIv2d_ns (i32 0)))>;
8339+
8340+
// SABAL patterns for add(x, zext(abs(y))) -> sabal(x, y, 0)
8341+
def : Pat<(v8i16 (add V128:$Vn, (zext (abs (v8i8 V64:$Vm))))),
8342+
(SABALv8i8_v8i16 V128:$Vn, V64:$Vm, (EXTRACT_SUBREG (MOVIv2d_ns (i32 0)), dsub))>;
8343+
def : Pat<(v4i32 (add V128:$Vn, (zext (abs (v4i16 V64:$Vm))))),
8344+
(SABALv4i16_v4i32 V128:$Vn, V64:$Vm, (EXTRACT_SUBREG (MOVIv2d_ns (i32 0)), dsub))>;
8345+
def : Pat<(v2i64 (add V128:$Vn, (zext (abs (v2i32 V64:$Vm))))),
8346+
(SABALv2i32_v2i64 V128:$Vn, V64:$Vm, (EXTRACT_SUBREG (MOVIv2d_ns (i32 0)), dsub))>;
8347+
8348+
83268349
//----------------------------------------------------------------------------
83278350
// AdvSIMD indexed element
83288351
//----------------------------------------------------------------------------

0 commit comments

Comments
 (0)