Skip to content

Commit 43c6c9a

Browse files
committed
[RISCV] Properly support RISCVISD::LLA in getTargetConstantFromLoad.
We need to pass the operand of LLA to GetSupportedConstantPool. This replaces llvm#142292 with test from there added as a pre-commit for both medlow and pic.
1 parent 4b7ecd7 commit 43c6c9a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21062,7 +21062,7 @@ RISCVTargetLowering::getTargetConstantFromLoad(LoadSDNode *Ld) const {
2106221062

2106321063
// Simple case, LLA.
2106421064
if (Ptr.getOpcode() == RISCVISD::LLA) {
21065-
auto *CNode = GetSupportedConstantPool(Ptr);
21065+
auto *CNode = GetSupportedConstantPool(Ptr.getOperand(0));
2106621066
if (!CNode || CNode->getTargetFlags() != 0)
2106721067
return nullptr;
2106821068

llvm/test/CodeGen/RISCV/constpool-known-bits.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ define i64 @test(i32 noundef signext %c, i32 noundef signext %d) {
3535
; PIC-NEXT: addi a0, a0, %pcrel_lo(.Lpcrel_hi0)
3636
; PIC-NEXT: ld a0, 0(a0)
3737
; PIC-NEXT: mul a0, a1, a0
38-
; PIC-NEXT: ori a0, a0, 127
38+
; PIC-NEXT: addi a0, a0, 127
3939
; PIC-NEXT: mul a0, a1, a0
4040
; PIC-NEXT: .Lpcrel_hi1:
4141
; PIC-NEXT: auipc a2, %pcrel_hi(.LCPI0_1)

0 commit comments

Comments
 (0)