Skip to content

Commit

Permalink
Merged master:9c4825ce282d into amd-gfx:676863267727
Browse files Browse the repository at this point in the history
Local branch amd-gfx 6768632 Merged master:c135a68d426f into amd-gfx:35fe0c30d0db
Remote branch master 9c4825c [mlir] do not use llvm.cmpxchg with floats
  • Loading branch information
Sw authored and Sw committed Aug 17, 2020
2 parents 6768632 + 9c4825c commit ef48fb9
Show file tree
Hide file tree
Showing 52 changed files with 1,154 additions and 423 deletions.
4 changes: 2 additions & 2 deletions clang/lib/AST/ExprConstant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11519,8 +11519,8 @@ bool IntExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
return false;

// For __atomic_is_lock_free(sizeof(_Atomic(T))), if the size is a power
// of two less than the maximum inline atomic width, we know it is
// lock-free. If the size isn't a power of two, or greater than the
// of two less than or equal to the maximum inline atomic width, we know it
// is lock-free. If the size isn't a power of two, or greater than the
// maximum alignment where we promote atomics, we know it is not lock-free
// (at least not in the sense of atomic_is_lock_free). Otherwise,
// the answer can only be determined at runtime; for example, 16-byte
Expand Down
8 changes: 8 additions & 0 deletions flang/test/Preprocessing/defines.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
! RUN: %f18 -E -DFOO=1 -DBAR=2 %s | FileCheck %s

! CHECK: integer :: a = 1
integer :: a = FOO
! CHECK: integer :: b = 2
integer :: b = BAR

end program
4 changes: 2 additions & 2 deletions lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1215,7 +1215,7 @@ TypeSP DWARFASTParserClang::ParseSubroutine(const DWARFDIE &die,
}

if (!function_decl) {
const char *name = attrs.name.GetCString();
llvm::StringRef name = attrs.name.GetStringRef();

// We currently generate function templates with template parameters in
// their name. In order to get closer to the AST that clang generates
Expand All @@ -1239,7 +1239,7 @@ TypeSP DWARFASTParserClang::ParseSubroutine(const DWARFDIE &die,
template_function_decl = m_ast.CreateFunctionDeclaration(
ignore_containing_context ? m_ast.GetTranslationUnitDecl()
: containing_decl_ctx,
GetOwningClangModule(die), attrs.name.GetCString(), clang_type,
GetOwningClangModule(die), attrs.name.GetStringRef(), clang_type,
attrs.storage, attrs.is_inline);
clang::FunctionTemplateDecl *func_template_decl =
m_ast.CreateFunctionTemplateDecl(
Expand Down
3 changes: 1 addition & 2 deletions lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1015,8 +1015,7 @@ PdbAstBuilder::GetOrCreateFunctionDecl(PdbCompilandSymId func_id) {
proc_name.consume_front("::");

clang::FunctionDecl *function_decl = m_clang.CreateFunctionDeclaration(
parent, OptionalClangModuleID(), proc_name.str().c_str(), func_ct,
storage, false);
parent, OptionalClangModuleID(), proc_name, func_ct, storage, false);

lldbassert(m_uid_to_decl.count(toOpaqueUid(func_id)) == 0);
m_uid_to_decl[toOpaqueUid(func_id)] = function_decl;
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,7 @@ PDBASTParser::GetDeclForSymbol(const llvm::pdb::PDBSymbol &symbol) {
: clang::StorageClass::SC_None;

auto decl = m_ast.CreateFunctionDeclaration(
decl_context, OptionalClangModuleID(), name.c_str(),
decl_context, OptionalClangModuleID(), name,
type->GetForwardCompilerType(), storage, func->hasInlineAttribute());

std::vector<clang::ParmVarDecl *> params;
Expand Down
7 changes: 2 additions & 5 deletions lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1965,11 +1965,8 @@ TypeSystemClang::GetOpaqueCompilerType(clang::ASTContext *ast,
#pragma mark Function Types

clang::DeclarationName
TypeSystemClang::GetDeclarationName(const char *name,
TypeSystemClang::GetDeclarationName(llvm::StringRef name,
const CompilerType &function_clang_type) {
if (!name || !name[0])
return clang::DeclarationName();

clang::OverloadedOperatorKind op_kind = clang::NUM_OVERLOADED_OPERATORS;
if (!IsOperator(name, op_kind) || op_kind == clang::NUM_OVERLOADED_OPERATORS)
return DeclarationName(&getASTContext().Idents.get(
Expand All @@ -1996,7 +1993,7 @@ TypeSystemClang::GetDeclarationName(const char *name,

FunctionDecl *TypeSystemClang::CreateFunctionDeclaration(
clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module,
const char *name, const CompilerType &function_clang_type,
llvm::StringRef name, const CompilerType &function_clang_type,
clang::StorageClass storage, bool is_inline) {
FunctionDecl *func_decl = nullptr;
ASTContext &ast = getASTContext();
Expand Down
12 changes: 6 additions & 6 deletions lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
Original file line number Diff line number Diff line change
Expand Up @@ -408,11 +408,10 @@ class TypeSystemClang : public TypeSystem {

// Function Types

clang::FunctionDecl *
CreateFunctionDeclaration(clang::DeclContext *decl_ctx,
OptionalClangModuleID owning_module,
const char *name, const CompilerType &function_Type,
clang::StorageClass storage, bool is_inline);
clang::FunctionDecl *CreateFunctionDeclaration(
clang::DeclContext *decl_ctx, OptionalClangModuleID owning_module,
llvm::StringRef name, const CompilerType &function_Type,
clang::StorageClass storage, bool is_inline);

CompilerType CreateFunctionType(const CompilerType &result_type,
const CompilerType *args, unsigned num_args,
Expand Down Expand Up @@ -1053,7 +1052,8 @@ class TypeSystemClang : public TypeSystem {
}

clang::DeclarationName
GetDeclarationName(const char *name, const CompilerType &function_clang_type);
GetDeclarationName(llvm::StringRef name,
const CompilerType &function_clang_type);

clang::LangOptions *GetLangOpts() const {
return m_language_options_up.get();
Expand Down
11 changes: 11 additions & 0 deletions lldb/test/API/macosx/simulator/TestSimulatorPlatform.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def run_with(self, arch, os, vers, env, expected_load_command):
self.expect('image list -b -t', patterns=['a\.out '+triple_re])
self.check_debugserver(log, os+env, vers)

@skipIfAsan
@skipUnlessDarwin
@skipIfDarwinEmbedded
@apple_simulator_test('iphone')
Expand All @@ -62,6 +63,7 @@ def test_ios(self):
os='ios', vers='', env='simulator',
expected_load_command='LC_BUILD_VERSION')

@skipIfAsan
@skipUnlessDarwin
@skipIfDarwinEmbedded
@apple_simulator_test('appletv')
Expand All @@ -72,6 +74,7 @@ def test_tvos(self):
os='tvos', vers='', env='simulator',
expected_load_command='LC_BUILD_VERSION')

@skipIfAsan
@skipUnlessDarwin
@skipIfDarwinEmbedded
@apple_simulator_test('watch')
Expand All @@ -84,6 +87,7 @@ def test_watchos_i386(self):
os='watchos', vers='', env='simulator',
expected_load_command='LC_BUILD_VERSION')

@skipIfAsan
@skipUnlessDarwin
@skipIfDarwinEmbedded
@apple_simulator_test('watch')
Expand Down Expand Up @@ -114,6 +118,7 @@ def test_lc_version_min_macosx(self):
self.run_with(arch=self.getArchitecture(),
os='macosx', vers='10.9', env='',
expected_load_command='LC_VERSION_MIN_MACOSX')
@skipIfAsan
@skipUnlessDarwin
@skipIfDarwinEmbedded
@apple_simulator_test('iphone')
Expand All @@ -126,6 +131,7 @@ def test_lc_version_min_iphoneos(self):
os='ios', vers='11.0', env='simulator',
expected_load_command='LC_VERSION_MIN_IPHONEOS')

@skipIfAsan
@skipUnlessDarwin
@skipIfDarwinEmbedded
@apple_simulator_test('iphone')
Expand All @@ -138,6 +144,7 @@ def test_ios_backdeploy_x86(self):
os='ios', vers='13.0', env='simulator',
expected_load_command='LC_BUILD_VERSION')

@skipIfAsan
@skipUnlessDarwin
@skipIfDarwinEmbedded
@apple_simulator_test('iphone')
Expand All @@ -149,6 +156,7 @@ def test_ios_backdeploy_apple_silicon(self):
os='ios', vers='11.0', env='simulator',
expected_load_command='LC_BUILD_VERSION')

@skipIfAsan
@skipUnlessDarwin
@skipIfDarwinEmbedded
@apple_simulator_test('appletv')
Expand All @@ -161,6 +169,7 @@ def test_lc_version_min_tvos(self):
os='tvos', vers='11.0', env='simulator',
expected_load_command='LC_VERSION_MIN_TVOS')

@skipIfAsan
@skipUnlessDarwin
@skipIfDarwinEmbedded
@apple_simulator_test('appletv')
Expand All @@ -172,6 +181,7 @@ def test_tvos_backdeploy_apple_silicon(self):
os='tvos', vers='11.0', env='simulator',
expected_load_command='LC_BUILD_VERSION')

@skipIfAsan
@skipUnlessDarwin
@skipIfDarwinEmbedded
@apple_simulator_test('watch')
Expand All @@ -185,6 +195,7 @@ def test_lc_version_min_watchos(self):
os='watchos', vers='4.0', env='simulator',
expected_load_command='LC_VERSION_MIN_WATCHOS')

@skipIfAsan
@skipUnlessDarwin
@skipIfDarwinEmbedded
@apple_simulator_test('watch')
Expand Down
14 changes: 14 additions & 0 deletions llvm/include/llvm/Analysis/DemandedBits.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,20 @@ class DemandedBits {

void print(raw_ostream &OS);

/// Compute alive bits of one addition operand from alive output and known
/// operand bits
static APInt determineLiveOperandBitsAdd(unsigned OperandNo,
const APInt &AOut,
const KnownBits &LHS,
const KnownBits &RHS);

/// Compute alive bits of one subtraction operand from alive output and known
/// operand bits
static APInt determineLiveOperandBitsSub(unsigned OperandNo,
const APInt &AOut,
const KnownBits &LHS,
const KnownBits &RHS);

private:
void performAnalysis();
void determineLiveOperandBits(const Instruction *UserI,
Expand Down
5 changes: 2 additions & 3 deletions llvm/include/llvm/CodeGen/GlobalISel/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,8 @@ const ConstantFP* getConstantFPVRegVal(Register VReg,
MachineInstr *getOpcodeDef(unsigned Opcode, Register Reg,
const MachineRegisterInfo &MRI);

/// Find the def instruction for \p Reg, folding away any trivial copies. Note
/// it may still return a COPY, if it changes the type. May return nullptr if \p
/// Reg is not a generic virtual register.
/// Find the def instruction for \p Reg, folding away any trivial copies. May
/// return nullptr if \p Reg is not a generic virtual register.
MachineInstr *getDefIgnoringCopies(Register Reg,
const MachineRegisterInfo &MRI);

Expand Down
24 changes: 17 additions & 7 deletions llvm/include/llvm/IR/DataLayout.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,19 +174,25 @@ class DataLayout {
/// well-defined bitwise representation.
SmallVector<unsigned, 8> NonIntegralAddressSpaces;

void setAlignment(AlignTypeEnum align_type, Align abi_align, Align pref_align,
uint32_t bit_width);
/// Attempts to set the alignment of the given type. Returns an error
/// description on failure.
Error setAlignment(AlignTypeEnum align_type, Align abi_align,
Align pref_align, uint32_t bit_width);

Align getAlignmentInfo(AlignTypeEnum align_type, uint32_t bit_width,
bool ABIAlign, Type *Ty) const;
void setPointerAlignment(uint32_t AddrSpace, Align ABIAlign, Align PrefAlign,
uint32_t TypeByteWidth, uint32_t IndexWidth);

/// Attempts to set the alignment of a pointer in the given address space.
/// Returns an error description on failure.
Error setPointerAlignment(uint32_t AddrSpace, Align ABIAlign, Align PrefAlign,
uint32_t TypeByteWidth, uint32_t IndexWidth);

/// Internal helper method that returns requested alignment for type.
Align getAlignment(Type *Ty, bool abi_or_pref) const;

/// Parses a target data specification string. Assert if the string is
/// malformed.
void parseSpecifier(StringRef LayoutDescription);
/// Attempts to parse a target data specification string and reports an error
/// if the string is malformed.
Error parseSpecifier(StringRef Desc);

// Free all internal data structures.
void clear();
Expand Down Expand Up @@ -229,6 +235,10 @@ class DataLayout {
/// Parse a data layout string (with fallback to default values).
void reset(StringRef LayoutDescription);

/// Parse a data layout string and return the layout. Return an error
/// description on failure.
static Expected<DataLayout> parse(StringRef LayoutDescription);

/// Layout endianness...
bool isLittleEndian() const { return !BigEndian; }
bool isBigEndian() const { return BigEndian; }
Expand Down
94 changes: 94 additions & 0 deletions llvm/lib/Analysis/DemandedBits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,21 @@ void DemandedBits::determineLiveOperandBits(
}
break;
case Instruction::Add:
if (AOut.isMask()) {
AB = AOut;
} else {
ComputeKnownBits(BitWidth, UserI->getOperand(0), UserI->getOperand(1));
AB = determineLiveOperandBitsAdd(OperandNo, AOut, Known, Known2);
}
break;
case Instruction::Sub:
if (AOut.isMask()) {
AB = AOut;
} else {
ComputeKnownBits(BitWidth, UserI->getOperand(0), UserI->getOperand(1));
AB = determineLiveOperandBitsSub(OperandNo, AOut, Known, Known2);
}
break;
case Instruction::Mul:
// Find the highest live output bit. We don't need any more input
// bits than that (adds, and thus subtracts, ripple only to the
Expand Down Expand Up @@ -469,6 +483,86 @@ void DemandedBits::print(raw_ostream &OS) {
}
}

static APInt determineLiveOperandBitsAddCarry(unsigned OperandNo,
const APInt &AOut,
const KnownBits &LHS,
const KnownBits &RHS,
bool CarryZero, bool CarryOne) {
assert(!(CarryZero && CarryOne) &&
"Carry can't be zero and one at the same time");

// The following check should be done by the caller, as it also indicates
// that LHS and RHS don't need to be computed.
//
// if (AOut.isMask())
// return AOut;

// Boundary bits' carry out is unaffected by their carry in.
APInt Bound = (LHS.Zero & RHS.Zero) | (LHS.One & RHS.One);

// First, the alive carry bits are determined from the alive output bits:
// Let demand ripple to the right but only up to any set bit in Bound.
// AOut = -1----
// Bound = ----1-
// ACarry&~AOut = --111-
APInt RBound = Bound.reverseBits();
APInt RAOut = AOut.reverseBits();
APInt RProp = RAOut + (RAOut | ~RBound);
APInt RACarry = RProp ^ ~RBound;
APInt ACarry = RACarry.reverseBits();

// Then, the alive input bits are determined from the alive carry bits:
APInt NeededToMaintainCarryZero;
APInt NeededToMaintainCarryOne;
if (OperandNo == 0) {
NeededToMaintainCarryZero = LHS.Zero | ~RHS.Zero;
NeededToMaintainCarryOne = LHS.One | ~RHS.One;
} else {
NeededToMaintainCarryZero = RHS.Zero | ~LHS.Zero;
NeededToMaintainCarryOne = RHS.One | ~LHS.One;
}

// As in computeForAddCarry
APInt PossibleSumZero = ~LHS.Zero + ~RHS.Zero + !CarryZero;
APInt PossibleSumOne = LHS.One + RHS.One + CarryOne;

// The below is simplified from
//
// APInt CarryKnownZero = ~(PossibleSumZero ^ LHS.Zero ^ RHS.Zero);
// APInt CarryKnownOne = PossibleSumOne ^ LHS.One ^ RHS.One;
// APInt CarryUnknown = ~(CarryKnownZero | CarryKnownOne);
//
// APInt NeededToMaintainCarry =
// (CarryKnownZero & NeededToMaintainCarryZero) |
// (CarryKnownOne & NeededToMaintainCarryOne) |
// CarryUnknown;

APInt NeededToMaintainCarry = (~PossibleSumZero | NeededToMaintainCarryZero) &
(PossibleSumOne | NeededToMaintainCarryOne);

APInt AB = AOut | (ACarry & NeededToMaintainCarry);
return AB;
}

APInt DemandedBits::determineLiveOperandBitsAdd(unsigned OperandNo,
const APInt &AOut,
const KnownBits &LHS,
const KnownBits &RHS) {
return determineLiveOperandBitsAddCarry(OperandNo, AOut, LHS, RHS, true,
false);
}

APInt DemandedBits::determineLiveOperandBitsSub(unsigned OperandNo,
const APInt &AOut,
const KnownBits &LHS,
const KnownBits &RHS) {
KnownBits NRHS;
NRHS.Zero = RHS.One;
NRHS.One = RHS.Zero;
return determineLiveOperandBitsAddCarry(OperandNo, AOut, LHS, NRHS, false,
true);
}

FunctionPass *llvm::createDemandedBitsWrapperPass() {
return new DemandedBitsWrapperPass();
}
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/GlobalISel/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ getDefSrcRegIgnoringCopies(Register Reg, const MachineRegisterInfo &MRI) {
while (DefMI->getOpcode() == TargetOpcode::COPY) {
Register SrcReg = DefMI->getOperand(1).getReg();
auto SrcTy = MRI.getType(SrcReg);
if (!SrcTy.isValid() || SrcTy != DstTy)
if (!SrcTy.isValid())
break;
DefMI = MRI.getVRegDef(SrcReg);
DefSrcReg = SrcReg;
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -631,8 +631,8 @@ Expected<Symbol &> EHFrameEdgeFixer::getOrCreateSymbol(ParseContext &PC,

// Determine whether we can register EH tables.
#if (defined(__GNUC__) && !defined(__ARM_EABI__) && !defined(__ia64__) && \
!(defined(_AIX) && defined(__ibmxl__)) && !defined(__SEH__) && \
!defined(__USING_SJLJ_EXCEPTIONS__))
!(defined(_AIX) && defined(__ibmxl__)) && !defined(__MVS__) && \
!defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__))
#define HAVE_EHTABLE_SUPPORT 1
#else
#define HAVE_EHTABLE_SUPPORT 0
Expand Down
Loading

0 comments on commit ef48fb9

Please sign in to comment.